more cleanup

This commit is contained in:
RickyRister 2025-01-04 01:44:48 -08:00
parent 5aa1cfea21
commit 57ef80d82d

View file

@ -111,32 +111,35 @@ void ZoneViewZone::zoneDumpReceived(const Response &r)
void ZoneViewZone::updateCardIds(CardAction action) void ZoneViewZone::updateCardIds(CardAction action)
{ {
if (origZone->contentsKnown()) {
return;
}
if (cards.isEmpty()) {
return;
}
int cardCount = cards.size(); int cardCount = cards.size();
if (!origZone->contentsKnown()) {
if (cards.isEmpty()) {
return;
}
auto startId = 0; auto startId = 0;
if (isReversed) { if (isReversed) {
// these get called after this zone's card list updates but before parent zone's card list updates // the card has not been added to origZone's cardList at this point
startId = origZone->getCards().size() - cardCount; startId = origZone->getCards().size() - cardCount;
switch (action) { switch (action) {
case INITIALIZE: case INITIALIZE:
break; break;
case ADD_CARD: case ADD_CARD:
startId += 1; startId += 1;
break; break;
case REMOVE_CARD: case REMOVE_CARD:
startId -= 1; startId -= 1;
break; break;
}
} }
}
for (int i = 0; i < cardCount; ++i) { for (int i = 0; i < cardCount; ++i) {
cards[i]->setId(i + startId); cards[i]->setId(i + startId);
}
} }
} }