summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-12-03 10:33:05 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-12-03 10:33:05 +0100
commit34e376a4908f8f2235d28314c4f779bbd1d09389 (patch)
tree4af1ebbf313d6a10bcde77d87a0cd4a3c30ad37e /common
parent391b6e2ad7541100191c2f2d4dd9ea5163de8f19 (diff)
Use PlayerState and GameState in Message::RoundState.
Diffstat (limited to 'common')
-rw-r--r--common/message.h57
1 files changed, 8 insertions, 49 deletions
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<RoundState> 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<class Archive>
- 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<class Archive>
void serialize(Archive & ar, const unsigned int v) {
ar & players;
- ar & dora;
+ ar & game;
ar & possible_actions;
- ar & current_player;
}
};