Prevent game from starting with unavailable map

This commit is contained in:
Gustas
2022-05-08 22:53:38 +03:00
committed by Matthias Mailänder
parent 7f404f64a6
commit 43e0cca663
2 changed files with 17 additions and 0 deletions

View File

@@ -259,6 +259,22 @@ namespace OpenRA.Mods.Common.Server
if (server.LobbyInfo.Slots.All(sl => server.LobbyInfo.ClientInSlot(sl.Key) == null))
return;
// Does the host have the map installed?
if (server.Type != ServerType.Dedicated && server.ModData.MapCache[server.Map.Uid].Status != MapStatus.Available)
{
// Client 0 will always be the Host
// In some cases client 0 doesn't exist, so we untick all players
var host = server.LobbyInfo.Clients.FirstOrDefault(c => c.Index == 0);
if (host != null)
host.State = Session.ClientState.NotReady;
else
foreach (var client in server.LobbyInfo.Clients)
client.State = Session.ClientState.NotReady;
server.SyncLobbyClients();
return;
}
if (LobbyUtils.InsufficientEnabledSpawnPoints(server.Map, server.LobbyInfo))
return;

View File

@@ -173,6 +173,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
retry.OnClick = () =>
{
modData.MapCache.UpdateMaps();
var (map, _) = getMap();
if (map.Status == MapStatus.DownloadError)
{