diff --git a/src/multiint.cpp b/src/multiint.cpp index c7972dd8749..71d1644c0ff 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))