From 33fa3ae0328f09e812e7aceccbf34ee84580feac Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Sat, 2 May 2015 17:25:41 +0200 Subject: [PATCH] Fixed revealing top card bug Previously if you were to reveal the top card, then look at the top x (x > 1) cards, then move them to another zone, the top card would stop being revealed. The issue was that when moving the cards the first card was being revealed, then being moved. I have also fixed an issue too: + reveal top card + scry 4 + grab all cards and move to the first column of available space at the left most of the screen (column 0). Everything is fine. + now try with another column (> 0), you will see that the card order has flipped. This no longer happens. This needs some testing before being merged. I will run the build for a while, right now it feels good though. --- common/server_player.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/server_player.cpp b/common/server_player.cpp index 644d02c7..e8574ba5 100644 --- a/common/server_player.cpp +++ b/common/server_player.cpp @@ -369,12 +369,15 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, Server_Car if (cardsToMove.isEmpty()) return Response::RespContextError; - MoveCardCompareFunctor cmp(startzone == targetzone ? -1 : x); + // 0 performs no sorting + // 1 reverses the sorting + MoveCardCompareFunctor cmp(0); qSort(cardsToMove.begin(), cardsToMove.end(), cmp); bool secondHalf = false; int xIndex = -1; - for (int cardIndex = 0; cardIndex < cardsToMove.size(); ++cardIndex) { + + for (int cardIndex = cardsToMove.size() - 1; cardIndex > -1; --cardIndex) { Server_Card *card = cardsToMove[cardIndex].first; const CardToMove *thisCardProperties = cardProperties.value(card); bool faceDown = thisCardProperties->has_face_down() ? thisCardProperties->face_down() : card->getFaceDown();