Refactor: Represent cardName + providerId with CardRef struct (#6039)

* card_ref.h

* update CardDatabase signatures

* make everything compile

* rename methods

* add docs

* mark stuff const

* set cardRef in CardItem

* cleanup

* fix build failure

* Fix builds on mac

---------

Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
This commit is contained in:
RickyRister
2025-07-15 19:14:02 -07:00
committed by GitHub
parent e05dad4267
commit a9b3be33e0
61 changed files with 328 additions and 305 deletions

View File

@@ -210,9 +210,7 @@ void Server_Player::setupZones()
continue;
}
for (int k = 0; k < currentCard->getNumber(); ++k) {
z->insertCard(
new Server_Card(currentCard->getName(), currentCard->getCardProviderId(), nextCardId++, 0, 0, z),
-1, 0);
z->insertCard(new Server_Card(currentCard->toCardRef(), nextCardId++, 0, 0, z), -1, 0);
}
}
}
@@ -1517,7 +1515,7 @@ Server_Player::cmdCreateToken(const Command_CreateToken &cmd, ResponseContainer
yCoord = 0;
}
auto *card = new Server_Card(cardName, cardProviderId, newCardId(), xCoord, yCoord);
auto *card = new Server_Card({cardName, cardProviderId}, newCardId(), xCoord, yCoord);
card->moveToThread(thread());
// Client should already prevent face-down tokens from having attributes; this just an extra server-side check
if (!cmd.face_down()) {