From 34e376a4908f8f2235d28314c4f779bbd1d09389 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Fri, 3 Dec 2010 10:33:05 +0100 Subject: Use PlayerState and GameState in Message::RoundState. --- common/message.h | 57 ++++++++------------------------------------------------ 1 file changed, 8 insertions(+), 49 deletions(-) (limited to 'common/message.h') diff --git a/common/message.h b/common/message.h index 0380b3e..1574838 100644 --- a/common/message.h +++ b/common/message.h @@ -12,6 +12,7 @@ using boost::dynamic_pointer_cast; #include "action.h" #include "tile.h" +#include "state.h" namespace Message { namespace Types { @@ -157,71 +158,29 @@ namespace Message { public: typedef boost::shared_ptr p; - // Player contents. - struct Player { - //! Concealed tiles in hand. - Tiles hand; - //! Open tiles in hand. - Tilegroups open; - //! Discarded tiles. - Tiles pond; - - //! Riichi declared? - bool riichi; - - //! Player's score - int score; - - //! Seat wind. - int wind; - - template - void serialize(Archive & ar, const unsigned int v) { - ar & hand; - ar & open; - ar & pond; - } - }; - RoundState() : Base(Types::RoundState) {} - RoundState(const Player& pl_d, const Player& pl_r, const Player& pl_u, const Player& pl_l, const Tiles& d, const Actions& a, int p) - : Base(Types::RoundState), dora(d), possible_actions(a), current_player(p) { + RoundState(const PlayerState& pl_d, const PlayerState& pl_r, const PlayerState& pl_u, const PlayerState& pl_l, const GameState& g, const Actions& a) + : Base(Types::RoundState), game(g), possible_actions(a) { players[0] = pl_d; players[1] = pl_r; players[2] = pl_u; players[3] = pl_l; } - //! Players. - Player players[4]; + //! Player states. + PlayerState players[4]; - //! List of dora/kandora. - Tiles dora; + //! Game state. + GameState game; //! List of actions client must return one of. Actions possible_actions; - //! Current player, relative to client. 0 = self, 1 = shimocha and so on. - int current_player; - - //! Round (prevalent) wind. - int round_wind; - - //! Round number (of this wind). - int round_number; - - //! Count of riichi sticks on table (current and leftovers). - int riichibou; - - //! Count of honba sticks on table (indicating renchan). - int honba; - template void serialize(Archive & ar, const unsigned int v) { ar & players; - ar & dora; + ar & game; ar & possible_actions; - ar & current_player; } }; -- cgit v1.2.3