convert Map.SpawnPoints to int2[]; tidy

This commit is contained in:
Chris Forbes
2011-10-18 20:34:00 +13:00
parent 0f7a744ef7
commit 59fdceb4fd
7 changed files with 23 additions and 14 deletions

View File

@@ -41,7 +41,14 @@ namespace OpenRA
[FieldLoader.Ignore] public Lazy<Dictionary<string, ActorReference>> Actors;
public int PlayerCount { get { return Players.Count(p => p.Value.Playable); } }
public IEnumerable<int2> SpawnPoints { get { return Actors.Value.Values.Where(a => a.Type == "mpspawn").Select(a => a.InitDict.Get<LocationInit>().value); } }
public int2[] GetSpawnPoints()
{
return Actors.Value.Values
.Where(a => a.Type == "mpspawn")
.Select(a => a.InitDict.Get<LocationInit>().value)
.ToArray();
}
public Rectangle Bounds;
@@ -420,7 +427,8 @@ namespace OpenRA
NonCombatant = true
});
for (int index = 0; index < SpawnPoints.Count(); index++)
var numSpawns = GetSpawnPoints().Length;
for (var index = 0; index < numSpawns; index++)
{
var p = new PlayerReference
{