From 5d48e31f05faca313bc51f2fc06ba4c0708a07f3 Mon Sep 17 00:00:00 2001 From: Monsterovich Date: Fri, 7 Jun 2024 04:58:40 +0200 Subject: [PATCH] Check that there are free slots for players --- src/multiint.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/multiint.cpp b/src/multiint.cpp index 956af336ef5..bce35e201ef 100644 --- a/src/multiint.cpp +++ b/src/multiint.cpp @@ -124,6 +124,7 @@ #include "activity.h" #include +#include #include "3rdparty/gsl_finally.h" #define MAP_PREVIEW_DISPLAY_TIME 2500 // number of milliseconds to show map in preview @@ -1960,8 +1961,6 @@ class WzPlayerIndexSwapPositionRowRactory : public WzPlayerSelectPositionRowFact } }; -#include - static std::set validPlayerIdxTargetsForPlayerPositionMove(uint32_t player) { std::set validTargetPlayerIdx; @@ -4016,8 +4015,8 @@ class WzPlayerRow : public WIDGET if (playerIdx == selectedPlayer || NetPlay.isHost) { uint32_t player = playerIdx; - // host can move any player, clients can request to move themselves - if ((player == selectedPlayer || (NetPlay.players[player].allocated && NetPlay.isHost)) + // host can move any player, clients can request to move themselves if there are available slots + if (((player == selectedPlayer && validPlayerIdxTargetsForPlayerPositionMove(player).size() > 0) || (NetPlay.players[player].allocated && NetPlay.isHost)) && !locked.position && player < MAX_PLAYERS && !isSpectatorOnlySlot(player))