fix(game): add initialization for drawCount_ in GameState classes

This commit is contained in:
Kieran Kihn
2025-12-11 23:07:22 +08:00
parent 49b30a7d5a
commit 2fa428a493

View File

@@ -137,6 +137,7 @@ namespace UNO::GAME {
{
this->players_ = players;
this->discardPile_ = discardPile;
this->drawCount_ = 0;
player_.draw(std::vector<Card>(handCard.begin(), handCard.end()));
this->currentPlayer_ = this->players_.begin() + static_cast<int>(currentPlayerIndex);
this->self_ = this->players_.begin() + static_cast<int>(selfIndex);
@@ -199,6 +200,7 @@ namespace UNO::GAME {
void ServerGameState::init()
{
this->drawCount_ = 0;
SPDLOG_INFO("Initializing server game state");
while (discardPile_.isEmpty() || discardPile_.getFront().getType() > CardType::NUM9) {
discardPile_.add(deck_.draw());