Fix maps without spawn points no longer working

This commit is contained in:
abcdefg30
2020-11-11 13:43:16 +01:00
committed by abcdefg30
parent 77e85e7c58
commit 8840a690c6
4 changed files with 22 additions and 9 deletions

View File

@@ -273,6 +273,21 @@ namespace OpenRA.Mods.Common.Widgets.Logic
orderManager.IssueOrder(Order.Command("spawn {0} {1}".F((playerToMove ?? orderManager.LocalClient).Index, selectedSpawnPoint)));
}
public static List<int> AvailableSpawnPoints(int spawnPoints, Session lobbyInfo)
{
return Enumerable.Range(1, spawnPoints).Except(lobbyInfo.DisabledSpawnPoints).ToList();
}
public static bool InsufficientEnabledSpawnPoints(MapPreview map, Session lobbyInfo)
{
// If a map doesn't define spawn points we always have enough space
var spawnPoints = map.SpawnPoints.Length;
if (spawnPoints == 0)
return false;
return AvailableSpawnPoints(spawnPoints, lobbyInfo).Count < lobbyInfo.Clients.Count(c => !c.IsObserver);
}
public static Color LatencyColor(Session.ClientPing ping)
{
if (ping == null)