mirror of
https://github.com/kierankihn/uno-game.git
synced 2025-12-27 02:13:18 +08:00
feat(game): add init method to ClientGameState
- Introduced `init` method to initialize `discardPile` in `ClientGameState`. - Added `<ranges>` header to support future range-based operations.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
#include "GameState.h"
|
||||
|
||||
#include <ranges>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
@@ -104,6 +105,12 @@ namespace UNO::GAME {
|
||||
return this->player_.getCards();
|
||||
}
|
||||
|
||||
void ClientGameState::init(DiscardPile discardPile)
|
||||
{
|
||||
this->discardPile_ = std::move(discardPile);
|
||||
}
|
||||
|
||||
|
||||
void ClientGameState::draw(const Card &card)
|
||||
{
|
||||
this->player_.draw(card);
|
||||
|
||||
@@ -318,6 +318,11 @@ namespace UNO::GAME {
|
||||
*/
|
||||
[[nodiscard]] const std::multiset<Card> &getCards() const;
|
||||
|
||||
/**
|
||||
* 初始化客户端状态
|
||||
*/
|
||||
void init(DiscardPile discardPile);
|
||||
|
||||
/**
|
||||
* 摸一张牌
|
||||
* @param card 摸的牌
|
||||
|
||||
Reference in New Issue
Block a user