server crash and inconsistency fix

This commit is contained in:
Max-Wilhelm Bruker 2010-11-23 02:07:56 +01:00
parent 4387f05ffa
commit ec602aefe1
2 changed files with 8 additions and 9 deletions

View file

@ -37,15 +37,11 @@ Server_Card::~Server_Card()
void Server_Card::resetState()
{
setCoords(0, 0);
counters.clear();
setTapped(false);
setAttacking(false);
setFaceDown(false);
setColor(QString());
setPT(QString());
setAnnotation(QString());
setDestroyOnZoneChange(false);
setDoesntUntap(false);
}

View file

@ -623,6 +623,8 @@ ResponseCode Server_ProtocolHandler::moveCard(Server_Game *game, Server_Player *
y = 0;
if (x == -1)
x = targetzone->cards.size();
card->resetState();
} else if (x == -1)
x = targetzone->getFreeGridColumn(y);
@ -1197,11 +1199,12 @@ ResponseCode Server_ProtocolHandler::cmdRevealCards(Command_RevealCards *cmd, Co
for (int i = 0; i < cardsToReveal.size(); ++i) {
Server_Card *card = cardsToReveal[i];
QList<ServerInfo_CardCounter *> cardCounterList;
QList<ServerInfo_CardCounter *> cardCounterListPrivate, cardCounterListOmniscient;
QMapIterator<int, int> cardCounterIterator(card->getCounters());
while (cardCounterIterator.hasNext()) {
cardCounterIterator.next();
cardCounterList.append(new ServerInfo_CardCounter(cardCounterIterator.key(), cardCounterIterator.value()));
cardCounterListPrivate.append(new ServerInfo_CardCounter(cardCounterIterator.key(), cardCounterIterator.value()));
cardCounterListOmniscient.append(new ServerInfo_CardCounter(cardCounterIterator.key(), cardCounterIterator.value()));
}
int attachPlayerId = -1;
@ -1214,8 +1217,8 @@ ResponseCode Server_ProtocolHandler::cmdRevealCards(Command_RevealCards *cmd, Co
}
if (cmd->getPlayerId() != -1)
respCardListPrivate.append(new ServerInfo_Card(card->getId(), card->getName(), card->getX(), card->getY(), card->getTapped(), card->getAttacking(), card->getColor(), card->getPT(), card->getAnnotation(), card->getDestroyOnZoneChange(), cardCounterList, attachPlayerId, attachZone, attachCardId));
respCardListOmniscient.append(new ServerInfo_Card(card->getId(), card->getName(), card->getX(), card->getY(), card->getTapped(), card->getAttacking(), card->getColor(), card->getPT(), card->getAnnotation(), card->getDestroyOnZoneChange(), cardCounterList, attachPlayerId, attachZone, attachCardId));
respCardListPrivate.append(new ServerInfo_Card(card->getId(), card->getName(), card->getX(), card->getY(), card->getTapped(), card->getAttacking(), card->getColor(), card->getPT(), card->getAnnotation(), card->getDestroyOnZoneChange(), cardCounterListPrivate, attachPlayerId, attachZone, attachCardId));
respCardListOmniscient.append(new ServerInfo_Card(card->getId(), card->getName(), card->getX(), card->getY(), card->getTapped(), card->getAttacking(), card->getColor(), card->getPT(), card->getAnnotation(), card->getDestroyOnZoneChange(), cardCounterListOmniscient, attachPlayerId, attachZone, attachCardId));
}
if (cmd->getPlayerId() == -1)