mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-06 18:14:23 -08:00
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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user