From b50b2f31b5986c05893fa9a80500d22a4dc6d666 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 6 Feb 2016 19:17:05 +0000 Subject: [PATCH] Restore key:value syntax for MapFolders. --- OpenRA.Game/Manifest.cs | 23 +++-------------------- mods/cnc/mod.yaml | 4 ++-- mods/d2k/mod.yaml | 4 ++-- mods/ra/mod.yaml | 4 ++-- mods/ts/mod.yaml | 4 ++-- 5 files changed, 11 insertions(+), 28 deletions(-) diff --git a/OpenRA.Game/Manifest.cs b/OpenRA.Game/Manifest.cs index 44f0c05f5f..536ffb794c 100644 --- a/OpenRA.Game/Manifest.cs +++ b/OpenRA.Game/Manifest.cs @@ -70,7 +70,7 @@ namespace OpenRA Mod.Id = modId; // TODO: Use fieldloader - MapFolders = YamlDictionary(yaml, "MapFolders", true); + MapFolders = YamlDictionary(yaml, "MapFolders"); MiniYaml packages; if (yaml.TryGetValue("Packages", out packages)) @@ -160,29 +160,12 @@ namespace OpenRA return yaml[key].ToDictionary().Keys.ToArray(); } - static IReadOnlyDictionary YamlDictionary(Dictionary yaml, string key, bool parsePaths = false) + static IReadOnlyDictionary YamlDictionary(Dictionary yaml, string key) { if (!yaml.ContainsKey(key)) return new ReadOnlyDictionary(); - var inner = new Dictionary(); - foreach (var node in yaml[key].Nodes) - { - var line = node.Key; - if (node.Value.Value != null) - line += ":" + node.Value.Value; - - // '@' may be used in mod.yaml to indicate extra information (similar to trait @ tags). - // Applies to MapFolders (to indicate System and User directories) and Packages (to indicate package annotation). - if (line.Contains('@')) - { - var split = line.Split('@'); - inner.Add(parsePaths ? Platform.ResolvePath(split[0]) : split[0], split[1]); - } - else - inner.Add(line, null); - } - + var inner = yaml[key].ToDictionary(my => my.Value); return new ReadOnlyDictionary(inner); } diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml index 4258872368..4ebdab8809 100644 --- a/mods/cnc/mod.yaml +++ b/mods/cnc/mod.yaml @@ -33,8 +33,8 @@ Packages: cnc|uibits MapFolders: - ./mods/cnc/maps@System - ~^maps/cnc/{DEV_VERSION}@User + cnc|maps: System + ~^maps/cnc/{DEV_VERSION}: User Rules: cnc|rules/misc.yaml diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index ed7ee62ab3..db73b1226e 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -25,8 +25,8 @@ Packages: d2k|uibits MapFolders: - ./mods/d2k/maps@System - ~^maps/d2k/{DEV_VERSION}@User + d2k|maps: System + ~^maps/d2k/{DEV_VERSION}: User Rules: d2k|rules/misc.yaml diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml index 768be898f9..4d6e00a694 100644 --- a/mods/ra/mod.yaml +++ b/mods/ra/mod.yaml @@ -33,8 +33,8 @@ Packages: ra|uibits MapFolders: - ./mods/ra/maps@System - ~^maps/ra/{DEV_VERSION}@User + ra|maps: System + ~^maps/ra/{DEV_VERSION}: User Rules: ra|rules/misc.yaml diff --git a/mods/ts/mod.yaml b/mods/ts/mod.yaml index 9eae04b910..4533b9f2dd 100644 --- a/mods/ts/mod.yaml +++ b/mods/ts/mod.yaml @@ -59,8 +59,8 @@ Packages: ts|uibits MapFolders: - ./mods/ts/maps@System - ~^maps/ts/{DEV_VERSION}@User + ts|maps: System + ~^maps/ts/{DEV_VERSION}: User Rules: ts|rules/ai.yaml