Give upgraded mpspawns an owner.

This commit is contained in:
Paul Chote
2011-02-23 21:54:11 +13:00
parent e90177ca58
commit 1df42a7d5e

View File

@@ -122,6 +122,12 @@ namespace OpenRA
if (MapFormat < 4) if (MapFormat < 4)
throw new InvalidDataException("Map format {0} is not supported.\n File: {1}".F(MapFormat, path)); throw new InvalidDataException("Map format {0} is not supported.\n File: {1}".F(MapFormat, path));
// Load players
foreach (var kv in yaml.NodesDict["Players"].NodesDict)
{
var player = new PlayerReference(kv.Value);
Players.Add(player.Name, player);
}
Actors = Lazy.New(() => Actors = Lazy.New(() =>
{ {
@@ -138,18 +144,14 @@ namespace OpenRA
string[] loc = wp.Value.Value.Split( ',' ); string[] loc = wp.Value.Value.Split( ',' );
var a = new ActorReference("mpspawn"); var a = new ActorReference("mpspawn");
a.Add(new LocationInit(new int2( int.Parse( loc[ 0 ] ), int.Parse( loc[ 1 ] ) ))); a.Add(new LocationInit(new int2( int.Parse( loc[ 0 ] ), int.Parse( loc[ 1 ] ) )));
a.Add(new OwnerInit(Players.First(p => p.Value.OwnsWorld).Key));
ret.Add(wp.Key, a); ret.Add(wp.Key, a);
} }
return ret; return ret;
}); });
// Load players
foreach (var kv in yaml.NodesDict["Players"].NodesDict)
{
var player = new PlayerReference(kv.Value);
Players.Add(player.Name, player);
}
// Upgrade map to format 5 // Upgrade map to format 5
if (MapFormat < 5) if (MapFormat < 5)