summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAtle Hellvik Havsø <atle@havso.net>2010-12-06 20:57:12 +0100
committerAtle Hellvik Havsø <atle@havso.net>2010-12-06 20:57:41 +0100
commit121387bfccc0ca2e35d39a8c1c92471f24e4848a (patch)
tree6c5b66d3f5758f086fd6c562477c767500e2fbc8 /common
parentb56b7bbcd5c23a67b57d4332ee05147e33ee7e6b (diff)
Added GameEnd message and made the GameEndDialog use it.
Diffstat (limited to 'common')
-rw-r--r--common/connectionbase.cpp6
-rw-r--r--common/message.h16
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;
};