From a0deb73df652b3cd76ee521761624e4869976402 Mon Sep 17 00:00:00 2001 From: knitknit <63179146+knitknit@users.noreply.github.com> Date: Sat, 2 Jan 2021 22:45:11 -0500 Subject: [PATCH] Fix #2771: Do not change x coordinates of moved card if it will be destroyed when it leaves the table (#4216) --- common/server_player.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/common/server_player.cpp b/common/server_player.cpp index e043f95f..db58a8c2 100644 --- a/common/server_player.cpp +++ b/common/server_player.cpp @@ -433,18 +433,23 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, lastDrawList.clear(); } - if ((startzone == targetzone) && !startzone->hasCoords()) { - if (!secondHalf && (originalPosition < x)) { - xIndex = -1; - secondHalf = true; - } else if (secondHalf) { - --xIndex; + // Only mess about with x coordinates if the card is sticking around, otherwise it can have weird side effects + // if multiple cards are moved at once. + if (!card->getDestroyOnZoneChange()) { + if ((startzone == targetzone) && !startzone->hasCoords()) { + if (!secondHalf && (originalPosition < x)) { + xIndex = -1; + secondHalf = true; + } else if (secondHalf) { + --xIndex; + } else { + ++xIndex; + } } else { ++xIndex; } - } else { - ++xIndex; } + int newX = x + xIndex; // Attachment relationships can be retained when moving a card onto the opponent's table