LoadMapBuildings,LoadMapUnits -> LoadMapActors

This commit is contained in:
Chris Forbes
2009-12-05 21:30:04 +13:00
parent efb4bb8677
commit 08727f5196

View File

@@ -75,15 +75,10 @@ namespace OpenRa.Game
new int2(treeReference.Location), new int2(treeReference.Location),
null)); null));
LoadMapActors(Rules.AllRules);
LoadMapBuildings(Rules.AllRules);
LoadMapUnits(Rules.AllRules);
PathFinder = new PathFinder(Rules.Map); PathFinder = new PathFinder(Rules.Map);
if (Replay != "") if (Replay != "")
orderManager = new OrderManager(new IOrderSource[] { new ReplayOrderSource(Replay) }); orderManager = new OrderManager(new IOrderSource[] { new ReplayOrderSource(Replay) });
else else
@@ -101,21 +96,13 @@ namespace OpenRa.Game
chrome = new Chrome(renderer); chrome = new Chrome(renderer);
} }
static void LoadMapBuildings(IniFile mapfile) static void LoadMapActors(IniFile mapfile)
{ {
foreach (var s in mapfile.GetSection("STRUCTURES", true)) var toLoad =
{ mapfile.GetSection("STRUCTURES", true)
//num=owner,type,health,location,facing,trigger,unknown,shouldRepair .Concat(mapfile.GetSection("UNITS", true));
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]));
}
}
static void LoadMapUnits(IniFile mapfile) foreach (var s in toLoad)
{
foreach (var s in mapfile.GetSection("UNITS", true))
{ {
//num=owner,type,health,location,facing,action,trigger //num=owner,type,health,location,facing,action,trigger
var parts = s.Value.Split( ',' ); var parts = s.Value.Split( ',' );