diff --git a/OpenRA.FileFormats/Map/Map.cs b/OpenRA.FileFormats/Map/Map.cs index d30df00d82..fcad926d00 100644 --- a/OpenRA.FileFormats/Map/Map.cs +++ b/OpenRA.FileFormats/Map/Map.cs @@ -41,17 +41,19 @@ namespace OpenRA.FileFormats public string Author; public int PlayerCount; public string Tileset; - + + public Dictionary Players = new Dictionary(); public Dictionary Actors = new Dictionary(); public List Smudges = new List(); public Dictionary Waypoints = new Dictionary(); - + // Rules overrides public Dictionary Rules = new Dictionary(); public Dictionary Weapons = new Dictionary(); public Dictionary Voices = new Dictionary(); public Dictionary Music = new Dictionary(); - public Dictionary Terrain = new Dictionary(); + public Dictionary Terrain = new Dictionary(); + // Binary map data public byte TileFormat = 1; public int2 MapSize; @@ -93,13 +95,20 @@ namespace OpenRA.FileFormats string[] loc = wp.Value.Value.Split(','); Waypoints.Add(wp.Key, new int2(int.Parse(loc[0]), int.Parse(loc[1]))); } - - // Actors + + // Players + foreach (var kv in yaml["Players"].Nodes) + { + var player = new PlayerReference(kv.Value); + Players.Add(player.Name, player); + } + + // Actors foreach (var kv in yaml["Actors"].Nodes) { string[] vals = kv.Value.Value.Split(' '); string[] loc = vals[2].Split(','); - var a = new ActorReference(vals[0], new int2(int.Parse(loc[0]), int.Parse(loc[1])), vals[2]); + var a = new ActorReference(vals[0], new int2(int.Parse(loc[0]), int.Parse(loc[1])), vals[1]); Actors.Add(kv.Key, a); } diff --git a/OpenRA.FileFormats/Map/PlayerReference.cs b/OpenRA.FileFormats/Map/PlayerReference.cs new file mode 100644 index 0000000000..e49a44afe9 --- /dev/null +++ b/OpenRA.FileFormats/Map/PlayerReference.cs @@ -0,0 +1,34 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion + +namespace OpenRA.FileFormats +{ + public class PlayerReference + { + public readonly string Name; + public readonly string Palette; + public readonly string Race; + + public PlayerReference(MiniYaml my) + { + FieldLoader.Load(this, my); + } + } +} diff --git a/OpenRA.FileFormats/OpenRA.FileFormats.csproj b/OpenRA.FileFormats/OpenRA.FileFormats.csproj index 453db670da..c085da35f3 100644 --- a/OpenRA.FileFormats/OpenRA.FileFormats.csproj +++ b/OpenRA.FileFormats/OpenRA.FileFormats.csproj @@ -1,4 +1,4 @@ - + Debug @@ -102,6 +102,7 @@ +