Fix "game is full" error when the game is not full.

Client.IsObserver is not valid to check until the
slot has been assigned.
This commit is contained in:
Paul Chote
2018-12-22 14:40:13 +13:00
committed by Oliver Brakmann
parent e71a31925f
commit d823d38e8c

View File

@@ -334,13 +334,6 @@ namespace OpenRA.Server
IsAdmin = !LobbyInfo.Clients.Any(c1 => c1.IsAdmin)
};
if (client.IsObserver && !LobbyInfo.GlobalSettings.AllowSpectators)
{
SendOrderTo(newConn, "ServerError", "The game is full");
DropClient(newConn);
return;
}
if (ModData.Manifest.Id != handshake.Mod)
{
Log.Write("server", "Rejected connection from {0}; mods do not match.",
@@ -375,6 +368,13 @@ namespace OpenRA.Server
{
client.Slot = LobbyInfo.FirstEmptySlot();
if (client.IsObserver && !LobbyInfo.GlobalSettings.AllowSpectators)
{
SendOrderTo(newConn, "ServerError", "The game is full");
DropClient(newConn);
return;
}
if (client.Slot != null)
SyncClientToPlayerReference(client, Map.Players.Players[client.Slot]);
else