From: miniduikboot Date: Tue, 7 Mar 2023 23:09:41 +0000 (+0100) Subject: Reorder GameFull and GameStarted join errors X-Git-Tag: v1.8.2~3 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=dede1c5b09f603f55df140c086e145481835901e;p=rhonda%2Fimpostor.git 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 --- diff --git a/src/Impostor.Server/Net/State/Game.Incoming.cs b/src/Impostor.Server/Net/State/Game.Incoming.cs index 4c9e7b8..fb0751f 100644 --- a/src/Impostor.Server/Net/State/Game.Incoming.cs +++ b/src/Impostor.Server/Net/State/Game.Incoming.cs @@ -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)