From cf5d49a328dc30e3a5804debda7f0238f19a9da8 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 21 May 2011 11:48:00 +1200 Subject: [PATCH] fix some subtle crap in map upgrader --- OpenRA.Game/Map.cs | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/OpenRA.Game/Map.cs b/OpenRA.Game/Map.cs index 628dd20ff0..78b03d2056 100644 --- a/OpenRA.Game/Map.cs +++ b/OpenRA.Game/Map.cs @@ -149,9 +149,25 @@ namespace OpenRA return ret; }); - + /* hack: make some slots. */ + if (!Players.Any(p => p.Value.Playable)) + { + for (int index = 0; index < SpawnPoints.Count(); index++) + { + var p = new PlayerReference + { + Name = "Multi{0}".F(index), + Race = "Random", + Playable = true, + DefaultStartingUnits = true, + Enemies = new[] { "Creeps" } + }; + Players.Add(p.Name, p); + } + } + // Upgrade map to format 5 if (MapFormat < 5) { @@ -171,26 +187,9 @@ namespace OpenRA Name = "Creeps", Race = "Random", NonCombatant = true, - Enemies = Players.Keys.Where(k => k != "Neutral").ToArray() + Enemies = Players.Where(p => p.Value.Playable).Select(p => p.Key).ToArray() }); } - - /* hack: make some slots. */ - if (!Players.Any(p => p.Value.Playable)) - { - for (int index = 0; index < SpawnPoints.Count(); index++) - { - var p = new PlayerReference - { - Name = "Multi{0}".F(index), - Race = "Random", - Playable = true, - DefaultStartingUnits = true, - Enemies = new[]{"Creeps"} - }; - Players.Add(p.Name, p); - } - } // Smudges Smudges = Lazy.New(() =>