From 08727f51963070a4c5141888752b66a2738bb120 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 5 Dec 2009 21:30:04 +1300 Subject: [PATCH] LoadMapBuildings,LoadMapUnits -> LoadMapActors --- OpenRa.Game/Game.cs | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 4c022eb28c..7fa1982c64 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -75,15 +75,10 @@ namespace OpenRa.Game new int2(treeReference.Location), null)); - - - LoadMapBuildings(Rules.AllRules); - LoadMapUnits(Rules.AllRules); + LoadMapActors(Rules.AllRules); PathFinder = new PathFinder(Rules.Map); - - if (Replay != "") orderManager = new OrderManager(new IOrderSource[] { new ReplayOrderSource(Replay) }); else @@ -101,21 +96,13 @@ namespace OpenRa.Game chrome = new Chrome(renderer); } - static void LoadMapBuildings(IniFile mapfile) + static void LoadMapActors(IniFile mapfile) { - foreach (var s in mapfile.GetSection("STRUCTURES", true)) - { - //num=owner,type,health,location,facing,trigger,unknown,shouldRepair - var parts = s.Value.Split(','); - var loc = int.Parse(parts[3]); - world.Add(new Actor(Rules.UnitInfo[parts[1].ToLowerInvariant()], new int2(loc % 128, loc / 128), - players.Values.FirstOrDefault(p => p.PlayerName == parts[0]) ?? players[0])); - } - } + var toLoad = + mapfile.GetSection("STRUCTURES", true) + .Concat(mapfile.GetSection("UNITS", true)); - static void LoadMapUnits(IniFile mapfile) - { - foreach (var s in mapfile.GetSection("UNITS", true)) + foreach (var s in toLoad) { //num=owner,type,health,location,facing,action,trigger var parts = s.Value.Split( ',' );