From 05266e4e3de7f8dd78c17514f89ab4ef399cb027 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 16 May 2022 00:28:06 +0300 Subject: [PATCH 43/43] create_command_newcomer(): Respect maxplayers setting See osdn #44185 Signed-off-by: Marko Lindqvist --- server/stdinhand.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/server/stdinhand.c b/server/stdinhand.c index 71a31eab53..f830c9c487 100644 --- a/server/stdinhand.c +++ b/server/stdinhand.c @@ -879,6 +879,10 @@ enum rfc_status create_command_newcomer(const char *name, _("Can't create players, no slots available.")); return C_FAIL; } + } else if (normal_player_count() == game.server.max_players) { + fc_snprintf(buf, buflen, + _("Maxplayers setting prevents creation of more players.")); + return C_FAIL; } } @@ -924,16 +928,6 @@ enum rfc_status create_command_newcomer(const char *name, new_slot = TRUE; } - if (new_slot) { - if (normal_player_count() == game.server.max_players) { - - fc_assert(game.server.max_players < MAX_NUM_PLAYERS); - - game.server.max_players++; - log_debug("Increased 'maxplayers' for creation of a new player."); - } - } - /* Create the new player. */ pplayer = server_create_player(-1, ai, NULL, FALSE); if (!pplayer) { -- 2.35.1