This commit is contained in:
Paul Chote
2010-05-23 22:39:43 +12:00
parent 9837b4ce32
commit 35ca5f80b2
9 changed files with 21 additions and 15 deletions

View File

@@ -134,12 +134,18 @@ namespace OpenRA.FileFormats
{
FieldInfo f = this.GetType().GetField(field);
if (f.GetValue(this) == null) continue;
root.Add(field, new MiniYaml(FieldSaver.FormatValue(this, f), null));
}
root.Add("Actors", MiniYaml.FromDictionary(Actors));
root.Add("Waypoints", MiniYaml.FromDictionary(Waypoints));
root.Add("Smudges", MiniYaml.FromList(Smudges));
root.Add(field, new MiniYaml(FieldSaver.FormatValue(this, f), null));
}
Dictionary<string, MiniYaml> playerYaml = new Dictionary<string, MiniYaml>();
foreach(var p in Players)
playerYaml.Add("PlayerReference@{0}".F(p.Key), FieldSaver.Save(p.Value));
root.Add("Players",new MiniYaml(null, playerYaml));
root.Add("Actors", MiniYaml.FromDictionary<string, ActorReference>(Actors));
root.Add("Waypoints", MiniYaml.FromDictionary<string, int2>(Waypoints));
root.Add("Smudges", MiniYaml.FromList<SmudgeReference>(Smudges));
root.Add("Rules", new MiniYaml(null, Rules));
SaveBinaryData(Path.Combine(filepath, "map.bin"));
root.WriteToFile(Path.Combine(filepath, "map.yaml"));