diff options
-rw-r--r-- | common/connectionbase.cpp | 6 | ||||
-rw-r--r-- | common/message.h | 16 |
2 files changed, 22 insertions, 0 deletions
diff --git a/common/connectionbase.cpp b/common/connectionbase.cpp index 448e833..9a110f7 100644 --- a/common/connectionbase.cpp +++ b/common/connectionbase.cpp @@ -116,6 +116,12 @@ void ConnectionBase::got_data(uint8_t* data, std::size_t bytes) { got_message(m); } break; + case Message::Types::GameEnd: { + Message::GameEnd::p m = make_shared<Message::GameEnd>(); + ia & m; + got_message(m); + } break; + default: throw std::runtime_error("Deserialization attempted on unknown message type."); } diff --git a/common/message.h b/common/message.h index 4390cdd..2be68c0 100644 --- a/common/message.h +++ b/common/message.h @@ -234,6 +234,8 @@ namespace Message { int won; Score score[4]; + bool game_end; + template<class Archive> void serialize(Archive & ar, const unsigned int v) { ar & hand; @@ -242,9 +244,23 @@ namespace Message { ar & total_fu; ar & won; ar & score; + ar & game_end; } }; + class GameEnd : public Base { + public: + typedef boost::shared_ptr<GameEnd> p; + Message::RoundEnd::Score scores[4]; + + GameEnd() : Base(Types::GameEnd) {} + + template<class Archive> + void serialize(Archive & ar, const unsigned int v) { + ar & scores; + } + + }; typedef boost::shared_ptr<Base> p; }; |