From 1811f7305ed9d7a46f6787106f3365b14f715c61 Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Sat, 13 Mar 2021 20:41:09 +0100 Subject: [PATCH] only invalidate undoDrawList up to moved card (#4280) --- common/server_player.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/server_player.cpp b/common/server_player.cpp index 01bb2253..3d184e9a 100644 --- a/common/server_player.cpp +++ b/common/server_player.cpp @@ -426,11 +426,13 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, int position = startzone->removeCard(card); // "Undo draw" should only remain valid if the just-drawn card stays within the user's hand (e.g., they only - // reorder their hand). If a just-drawn card leaves the hand then clear lastDrawList to invalidate "undo draw." + // reorder their hand). If a just-drawn card leaves the hand then remove cards before it from the list // (Ignore the case where the card is currently being un-drawn.) - if (startzone->getName() == "hand" && targetzone->getName() != "hand" && lastDrawList.contains(card->getId()) && - !undoingDraw) { - lastDrawList.clear(); + if (startzone->getName() == "hand" && targetzone->getName() != "hand" && !undoingDraw) { + int index = lastDrawList.lastIndexOf(card->getId()); + if (index != -1) { + lastDrawList.erase(lastDrawList.begin(), lastDrawList.begin() + index); + } } // Attachment relationships can be retained when moving a card onto the opponent's table