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

@@ -13,6 +13,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.Common.Widgets.Logic;
using OpenRA.Network;
using OpenRA.Primitives;
using OpenRA.Server;
@@ -124,9 +125,7 @@ namespace OpenRA.Mods.Common.Server
if (server.LobbyInfo.Slots.Any(sl => sl.Value.Required && server.LobbyInfo.ClientInSlot(sl.Key) == null))
return;
// Can't have insufficient spawns
var availableSpawnPointCount = server.Map.SpawnPoints.Length - server.LobbyInfo.DisabledSpawnPoints.Count;
if (availableSpawnPointCount < server.LobbyInfo.Clients.Count(c => !c.IsObserver))
if (LobbyUtils.InsufficientEnabledSpawnPoints(server.Map, server.LobbyInfo))
return;
server.StartGame();
@@ -176,8 +175,7 @@ namespace OpenRA.Mods.Common.Server
return true;
}
var availableSpawnPointCount = server.Map.SpawnPoints.Length - server.LobbyInfo.DisabledSpawnPoints.Count;
if (availableSpawnPointCount < server.LobbyInfo.Clients.Count(c => !c.IsObserver))
if (LobbyUtils.InsufficientEnabledSpawnPoints(server.Map, server.LobbyInfo))
{
server.SendOrderTo(conn, "Message", "Unable to start the game until more spawn points are enabled.");
return true;