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.
This commit is contained in:
Matt Lowe 2015-05-02 17:25:41 +02:00
parent 9ff22eaf17
commit 33fa3ae032

View file

@ -369,12 +369,15 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, Server_Car
if (cardsToMove.isEmpty()) if (cardsToMove.isEmpty())
return Response::RespContextError; 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); qSort(cardsToMove.begin(), cardsToMove.end(), cmp);
bool secondHalf = false; bool secondHalf = false;
int xIndex = -1; 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; Server_Card *card = cardsToMove[cardIndex].first;
const CardToMove *thisCardProperties = cardProperties.value(card); const CardToMove *thisCardProperties = cardProperties.value(card);
bool faceDown = thisCardProperties->has_face_down() ? thisCardProperties->face_down() : card->getFaceDown(); bool faceDown = thisCardProperties->has_face_down() ? thisCardProperties->face_down() : card->getFaceDown();