mirror of
https://github.com/kierankihn/uno-game.git
synced 2025-12-27 02:13:18 +08:00
refactor(game): encapsulate Player and ClientGameState state management
- Replaced public `Player::handCard` pointer with private `HandCard` member. - Introduced `draw`, `play`, and `getCards` methods in `Player` and `ClientGameState`. - Modified `ClientGameState` constructor to accept player name instead of `Player` object. - Updated tests to reflect new `Player` and `ClientGameState` structure.
This commit is contained in:
@@ -13,11 +13,7 @@
|
||||
|
||||
TEST(game_state_test, game_state_test_1)
|
||||
{
|
||||
UNO::GAME::HandCard handCard;
|
||||
UNO::GAME::Player player(std::string("lzh"));
|
||||
player.handCard = &handCard;
|
||||
|
||||
UNO::GAME::ClientGameState clientGameState(UNO::GAME::GameStatus::WAITING_PLAYERS_TO_NEXT_TURN, player);
|
||||
UNO::GAME::ClientGameState clientGameState(UNO::GAME::GameStatus::WAITING_PLAYERS_TO_NEXT_TURN, std::string("lzh"));
|
||||
|
||||
UNO::GAME::ClientPlayerState playerState1("pkq", 100, false);
|
||||
UNO::GAME::ClientPlayerState playerState2("kpq", 100, false);
|
||||
|
||||
Reference in New Issue
Block a user