summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/message.cpp22
-rw-r--r--common/message.h25
2 files changed, 28 insertions, 19 deletions
diff --git a/common/message.cpp b/common/message.cpp
index 08c2cdd..4552f2e 100644
--- a/common/message.cpp
+++ b/common/message.cpp
@@ -136,28 +136,22 @@ Message::RoundState::RoundState() : BoostBase(Types::RoundState) {
}
-Message::RoundState::RoundState(State state) : BoostBase(Types::RoundState) {
- // Compatibility constructor. To be removed.
- for(std::size_t i = 0; i < 4; i++) {
- hand[i] = state.players[i].hand;
- open[i] = state.players[i].open;
- pond[i] = state.players[i].pond;
- possible_actions = state.possible_actions;
- }
+Message::RoundState::RoundState(const Player& pl_d, const Player& pl_r, const Player& pl_u, const Player& pl_l, const Tiles& d, const Actions& a)
+ : BoostBase(Types::RoundState), dora(d), possible_actions(a) {
+ players[0] = pl_d;
+ players[1] = pl_d;
+ players[2] = pl_d;
+ players[3] = pl_d;
}
void Message::RoundState::serialize(boost::archive::text_oarchive& ar) {
- ar & hand;
- ar & open;
- ar & pond;
+ ar & players;
ar & dora;
ar & possible_actions;
}
void Message::RoundState::deserialize(boost::archive::text_iarchive& ar) {
- ar & hand;
- ar & open;
- ar & pond;
+ ar & players;
ar & dora;
ar & possible_actions;
}
diff --git a/common/message.h b/common/message.h
index cb709af..6f48742 100644
--- a/common/message.h
+++ b/common/message.h
@@ -13,7 +13,7 @@ using boost::dynamic_pointer_cast;
#include <vector>
#include <string>
-#include "state.h"
+#include "action.h"
#include "tile.h"
namespace Message {
@@ -139,12 +139,27 @@ namespace Message {
public:
typedef boost::shared_ptr<RoundState> p;
+ // Player contents.
+ struct Player {
+ //! Concealed tiles in hand.
+ Tiles hand;
+ //! Open tiles in hand.
+ Tiles open;
+ //! Discarded tiles.
+ Tiles pond;
+
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int version) {
+ ar & hand;
+ ar & open;
+ ar & pond;
+ }
+ };
+
RoundState();
- RoundState(State state);
+ RoundState(const Player& pl_d, const Player& pl_r, const Player& pl_u, const Player& pl_l, const Tiles& d, const Actions& a);
- Tiles hand[4];
- Tiles open[4];
- Tiles pond[4];
+ Player players[4];
Tiles dora;