move changing x coord to after check for token deletion (#4236)
fixes #4235 reverts #4216
This commit is contained in:
parent
1bfcca91be
commit
401fdcaf7a
1 changed files with 28 additions and 33 deletions
|
@ -433,25 +433,6 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges,
|
||||||
lastDrawList.clear();
|
lastDrawList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int newX = x + xIndex;
|
|
||||||
|
|
||||||
// Attachment relationships can be retained when moving a card onto the opponent's table
|
// Attachment relationships can be retained when moving a card onto the opponent's table
|
||||||
if (startzone->getName() != targetzone->getName()) {
|
if (startzone->getName() != targetzone->getName()) {
|
||||||
// Delete all attachment relationships
|
// Delete all attachment relationships
|
||||||
|
@ -491,6 +472,20 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges,
|
||||||
|
|
||||||
card->deleteLater();
|
card->deleteLater();
|
||||||
} else {
|
} else {
|
||||||
|
if ((startzone == targetzone) && !startzone->hasCoords()) {
|
||||||
|
if (!secondHalf && (originalPosition < x)) {
|
||||||
|
xIndex = -1;
|
||||||
|
secondHalf = true;
|
||||||
|
} else if (secondHalf) {
|
||||||
|
--xIndex;
|
||||||
|
} else {
|
||||||
|
++xIndex;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
++xIndex;
|
||||||
|
}
|
||||||
|
int newX = x + xIndex;
|
||||||
|
|
||||||
if (!targetzone->hasCoords()) {
|
if (!targetzone->hasCoords()) {
|
||||||
y = 0;
|
y = 0;
|
||||||
card->resetState();
|
card->resetState();
|
||||||
|
@ -597,22 +592,22 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges,
|
||||||
setCardAttrHelper(ges, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), card->getId(),
|
setCardAttrHelper(ges, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), card->getId(),
|
||||||
AttrPT, ptString);
|
AttrPT, ptString);
|
||||||
}
|
}
|
||||||
}
|
if (startzone->getAlwaysRevealTopCard() && !startzone->getCards().isEmpty() && (originalPosition == 0)) {
|
||||||
if (startzone->getAlwaysRevealTopCard() && !startzone->getCards().isEmpty() && (originalPosition == 0)) {
|
Event_RevealCards revealEvent;
|
||||||
Event_RevealCards revealEvent;
|
revealEvent.set_zone_name(startzone->getName().toStdString());
|
||||||
revealEvent.set_zone_name(startzone->getName().toStdString());
|
revealEvent.set_card_id(0);
|
||||||
revealEvent.set_card_id(0);
|
startzone->getCards().first()->getInfo(revealEvent.add_cards());
|
||||||
startzone->getCards().first()->getInfo(revealEvent.add_cards());
|
|
||||||
|
|
||||||
ges.enqueueGameEvent(revealEvent, playerId);
|
ges.enqueueGameEvent(revealEvent, playerId);
|
||||||
}
|
}
|
||||||
if (targetzone->getAlwaysRevealTopCard() && !targetzone->getCards().isEmpty() && (newX == 0)) {
|
if (targetzone->getAlwaysRevealTopCard() && !targetzone->getCards().isEmpty() && (newX == 0)) {
|
||||||
Event_RevealCards revealEvent;
|
Event_RevealCards revealEvent;
|
||||||
revealEvent.set_zone_name(targetzone->getName().toStdString());
|
revealEvent.set_zone_name(targetzone->getName().toStdString());
|
||||||
revealEvent.set_card_id(0);
|
revealEvent.set_card_id(0);
|
||||||
targetzone->getCards().first()->getInfo(revealEvent.add_cards());
|
targetzone->getCards().first()->getInfo(revealEvent.add_cards());
|
||||||
|
|
||||||
ges.enqueueGameEvent(revealEvent, playerId);
|
ges.enqueueGameEvent(revealEvent, playerId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (undoingDraw) {
|
if (undoingDraw) {
|
||||||
|
|
Loading…
Reference in a new issue