Refactor map-actor loading
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user