This commit is contained in:
parent
b9c4b496e4
commit
8fb561b4c4
1 changed files with 8 additions and 4 deletions
|
@ -575,15 +575,19 @@ void Server_Game::unattachCards(GameEventStorage &ges, Server_Player *player)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&gameMutex);
|
QMutexLocker locker(&gameMutex);
|
||||||
|
|
||||||
QMapIterator<QString, Server_CardZone *> zoneIterator(player->getZones());
|
for (auto zone : player->getZones()) {
|
||||||
for (Server_CardZone *zone : player->getZones()) {
|
for (auto card : zone->getCards()) {
|
||||||
for (Server_Card *card : zone->getCards()) {
|
|
||||||
if (card == nullptr) {
|
if (card == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto &attachedCardsBase = card->getAttachedCards();
|
||||||
|
if (attachedCardsBase.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Make a copy of the list because the original one gets modified during the loop
|
// Make a copy of the list because the original one gets modified during the loop
|
||||||
QList<Server_Card *> attachedCards = card->getAttachedCards();
|
QList<Server_Card *> attachedCards = {attachedCardsBase};
|
||||||
for (Server_Card *attachedCard : attachedCards) {
|
for (Server_Card *attachedCard : attachedCards) {
|
||||||
attachedCard->getZone()->getPlayer()->unattachCard(ges, attachedCard);
|
attachedCard->getZone()->getPlayer()->unattachCard(ges, attachedCard);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue