refactor(game): return drawn cards in updateStateByDraw

- Updated `updateStateByDraw` to return a `std::vector<Card>` instead of `void`.
- Adjusted `ServerGameState`, `GameState`, and `ClientGameState` implementations to reflect the change.
This commit is contained in:
Kieran Kihn
2025-12-02 12:06:06 +08:00
parent e5304b8c6c
commit 8a00b66047
2 changed files with 9 additions and 6 deletions

View File

@@ -146,13 +146,15 @@ namespace UNO::GAME {
}
}
void ServerGameState::updateStateByDraw()
std::vector<Card> ServerGameState::updateStateByDraw()
{
if (this->drawCount_ == 0) {
this->drawCount_ = 1;
}
this->currentPlayer_->draw(this->drawCount_, deck_.draw(this->drawCount_));
auto cards = deck_.draw(this->drawCount_);
this->currentPlayer_->draw(this->drawCount_, cards);
this->drawCount_ = 0;
this->nextPlayer();
return cards;
}
} // namespace UNO::GAME