Refactor map-actor loading

This commit is contained in:
Paul Chote
2010-03-03 20:04:07 +13:00
parent ae2bbae16c
commit 97bdb9b63f
8 changed files with 57 additions and 65 deletions

View File

@@ -200,22 +200,6 @@ namespace OpenRA
return xy;
}
public static void LoadMapActors(this World world, IniFile mapfile)
{
var toLoad =
mapfile.GetSection("STRUCTURES", true)
.Concat(mapfile.GetSection("UNITS", true));
foreach (var s in toLoad)
{
//num=owner,type,health,location,facing,...
var parts = s.Value.Split( ',' );
var loc = int.Parse(parts[3]);
world.CreateActor(parts[1].ToLowerInvariant(), new int2(loc % 128, loc / 128),
world.players.Values.FirstOrDefault(p => p.InternalName == parts[0]) ?? world.players[0]);
}
}
public static int2 ChooseRandomEdgeCell(this World w)
{
var isX = w.SharedRandom.Next(2) == 0;