crash fix; weird behaviour fix
This commit is contained in:
parent
6253d92053
commit
1b286973dd
3 changed files with 10 additions and 3 deletions
|
@ -52,11 +52,12 @@ void CardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
QPointF sp = pos();
|
||||
sc->removeItem(this);
|
||||
|
||||
if (currentZone) {
|
||||
CardZone *startZone = static_cast<CardItem *>(item)->getZone();
|
||||
if (currentZone && !(static_cast<CardItem *>(item)->getAttachedTo() && (startZone == currentZone))) {
|
||||
currentZone->handleDropEvent(id, startZone, (sp - currentZone->scenePos()).toPoint(), faceDown);
|
||||
for (int i = 0; i < childDrags.size(); i++) {
|
||||
CardDragItem *c = static_cast<CardDragItem *>(childDrags[i]);
|
||||
if (!(static_cast<CardItem *>(c->item)->getAttachedTo() && (startZone == currentZone)))
|
||||
currentZone->handleDropEvent(c->id, startZone, (sp - currentZone->scenePos() + c->getHotSpot()).toPoint(), faceDown);
|
||||
sc->removeItem(c);
|
||||
}
|
||||
|
|
|
@ -628,6 +628,9 @@ void Player::eventMoveCard(Event_MoveCard *event)
|
|||
if (!card)
|
||||
return;
|
||||
|
||||
if (card->getAttachedTo() && (startZone != targetZone))
|
||||
card->setAttachedTo(0);
|
||||
|
||||
card->deleteDragItem();
|
||||
|
||||
card->setId(event->getNewCardId());
|
||||
|
|
|
@ -518,6 +518,9 @@ ResponseCode Server_ProtocolHandler::moveCard(Server_Game *game, Server_Player *
|
|||
return RespNameNotFound;
|
||||
|
||||
if (startzone != targetzone) {
|
||||
if (card->getParentCard())
|
||||
card->setParentCard(0);
|
||||
|
||||
const QList<Server_Card *> &attachedCards = card->getAttachedCards();
|
||||
for (int i = 0; i < attachedCards.size(); ++i)
|
||||
unattachCard(game, attachedCards[i]->getZone()->getPlayer(), cont, attachedCards[i]);
|
||||
|
|
Loading…
Reference in a new issue