Reorganize actor and smudge loading.

The actor and smudge definitions are now stored
as raw MiniYamlNodes in the map.  It is now the
responsibility of the consumers to parse these
into real objects.
This commit is contained in:
Paul Chote
2015-04-03 19:23:41 +01:00
parent ea679d4557
commit 4b1f541f34
14 changed files with 104 additions and 132 deletions

View File

@@ -297,7 +297,7 @@ namespace OpenRA.Mods.D2k.UtilityCommands
return null;
map.RequiresMod = mod;
var players = new MapPlayers(map.Rules, map.GetSpawnPoints().Length);
var players = new MapPlayers(map.Rules, map.SpawnPoints.Value.Length);
map.PlayerDefinitions = players.ToMiniYaml();
return map;
@@ -314,8 +314,6 @@ namespace OpenRA.Mods.D2k.UtilityCommands
map.MapSize = new int2(mapSize.Width + 2 * MapCordonWidth, mapSize.Height + 2 * MapCordonWidth);
map.Bounds = new Rectangle(MapCordonWidth, MapCordonWidth, mapSize.Width, mapSize.Height);
map.Smudges = Exts.Lazy(() => new List<SmudgeReference>());
map.Actors = Exts.Lazy(() => new Dictionary<string, ActorReference>());
map.MapResources = Exts.Lazy(() => new CellLayer<ResourceTile>(TileShape.Rectangle, new Size(map.MapSize.X, map.MapSize.Y)));
map.MapTiles = Exts.Lazy(() => new CellLayer<TerrainTile>(TileShape.Rectangle, new Size(map.MapSize.X, map.MapSize.Y)));
@@ -357,7 +355,7 @@ namespace OpenRA.Mods.D2k.UtilityCommands
new LocationInit(locationOnMap),
new OwnerInit(kvp.Second)
};
map.Actors.Value.Add("Actor" + map.Actors.Value.Count, a);
map.ActorDefinitions.Add(new MiniYamlNode("Actor" + map.ActorDefinitions.Count, a.Save()));
}
}
}