mirror of
https://github.com/kierankihn/uno-game.git
synced 2025-12-27 10:23:16 +08:00
fix(game): add initialization for drawCount_ in GameState classes
This commit is contained in:
@@ -137,6 +137,7 @@ namespace UNO::GAME {
|
|||||||
{
|
{
|
||||||
this->players_ = players;
|
this->players_ = players;
|
||||||
this->discardPile_ = discardPile;
|
this->discardPile_ = discardPile;
|
||||||
|
this->drawCount_ = 0;
|
||||||
player_.draw(std::vector<Card>(handCard.begin(), handCard.end()));
|
player_.draw(std::vector<Card>(handCard.begin(), handCard.end()));
|
||||||
this->currentPlayer_ = this->players_.begin() + static_cast<int>(currentPlayerIndex);
|
this->currentPlayer_ = this->players_.begin() + static_cast<int>(currentPlayerIndex);
|
||||||
this->self_ = this->players_.begin() + static_cast<int>(selfIndex);
|
this->self_ = this->players_.begin() + static_cast<int>(selfIndex);
|
||||||
@@ -199,6 +200,7 @@ namespace UNO::GAME {
|
|||||||
|
|
||||||
void ServerGameState::init()
|
void ServerGameState::init()
|
||||||
{
|
{
|
||||||
|
this->drawCount_ = 0;
|
||||||
SPDLOG_INFO("Initializing server game state");
|
SPDLOG_INFO("Initializing server game state");
|
||||||
while (discardPile_.isEmpty() || discardPile_.getFront().getType() > CardType::NUM9) {
|
while (discardPile_.isEmpty() || discardPile_.getFront().getType() > CardType::NUM9) {
|
||||||
discardPile_.add(deck_.draw());
|
discardPile_.add(deck_.draw());
|
||||||
|
|||||||
Reference in New Issue
Block a user