From dede1c5b09f603f55df140c086e145481835901e Mon Sep 17 00:00:00 2001 From: miniduikboot Date: Wed, 8 Mar 2023 00:09:41 +0100 Subject: [PATCH] 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 --- src/Impostor.Server/Net/State/Game.Incoming.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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) -- 2.39.5