mirror of
https://github.com/kierankihn/uno-game.git
synced 2025-12-27 02:13:18 +08:00
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:
@@ -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
|
||||
Reference in New Issue
Block a user