Reorder GameFull and GameStarted join errors

If a game is in progress, a player can't join it anyway and spam-joining
to see if a spot becomes available is useless. So the GameFull error is
more important than the GameStarted error, therefore reorder them.

Closes: #518
This commit is contained in:
miniduikboot committed 2023-03-08 20:46:29 +01:00
1 parent b31e3bf1e3
commit dede1c5b09
1 file changed
+8 -8
@@ -166,14 +166,6 @@ namespace Impostor.Server.Net.State
}
}
// Check if;
// - The player is already in this game.
// - The game is full.
if (player?.Game != this && _players.Count >= Options.MaxPlayers)
{
return GameJoinResult.FromError(GameJoinError.GameFull);
}
if (GameState == GameStates.Starting || GameState == GameStates.Started)
{
return GameJoinResult.FromError(GameJoinError.GameStarted);
@@ -184,6 +176,14 @@ namespace Impostor.Server.Net.State
return GameJoinResult.FromError(GameJoinError.GameDestroyed);
}
// Check if;
// - The player is already in this game.
// - The game is full.
if (player?.Game != this && _players.Count >= Options.MaxPlayers)
{
return GameJoinResult.FromError(GameJoinError.GameFull);
}
var isNew = false;
if (player == null || player.Game != this)