summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-11-30 23:59:09 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-11-30 23:59:09 +0100
commit272f4f8b4b12e4d732b1a5adaa37b318c0058675 (patch)
tree0dfaf1483603d1af1c64f879cf00fa93b7f3fcfe /common
parentbf3b20f58d400c3961ce4d162cf314ff3ed4895e (diff)
Add LobbyStatus and LobbyAction messages.
Diffstat (limited to 'common')
-rw-r--r--common/connectionbase.cpp22
-rw-r--r--common/message.h28
2 files changed, 50 insertions, 0 deletions
diff --git a/common/connectionbase.cpp b/common/connectionbase.cpp
index 75a9a9a..448e833 100644
--- a/common/connectionbase.cpp
+++ b/common/connectionbase.cpp
@@ -68,6 +68,18 @@ void ConnectionBase::got_data(uint8_t* data, std::size_t bytes) {
got_message(m);
} break;
+ case Message::Types::LobbyStatus: {
+ Message::LobbyStatus::p m = make_shared<Message::LobbyStatus>();
+ ia & m;
+ got_message(m);
+ } break;
+
+ case Message::Types::LobbyAction: {
+ Message::LobbyAction::p m = make_shared<Message::LobbyAction>();
+ ia & m;
+ got_message(m);
+ } break;
+
case Message::Types::GameStart: {
Message::GameStart::p m = make_shared<Message::GameStart>();
ia & m;
@@ -134,6 +146,16 @@ void ConnectionBase::send(const Message::p& msg) {
oa & m;
} break;
+ case Message::Types::LobbyStatus: {
+ Message::LobbyStatus::p m = dynamic_pointer_cast<Message::LobbyStatus>(msg);
+ oa & m;
+ } break;
+
+ case Message::Types::LobbyAction: {
+ Message::LobbyAction::p m = dynamic_pointer_cast<Message::LobbyAction>(msg);
+ oa & m;
+ } break;
+
case Message::Types::GameStart: {
Message::GameStart::p m = dynamic_pointer_cast<Message::GameStart>(msg);
oa & m;
diff --git a/common/message.h b/common/message.h
index d2eb5d7..53e6b5e 100644
--- a/common/message.h
+++ b/common/message.h
@@ -85,6 +85,34 @@ namespace Message {
}
};
+ class LobbyStatus : public Base {
+ public:
+ typedef boost::shared_ptr<LobbyStatus> p;
+
+ LobbyStatus() : Base(Types::LobbyStatus) {}
+
+ std::vector<std::string> game_modes;
+
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int v) {
+ ar & game_modes;
+ }
+ };
+
+ class LobbyAction : public Base {
+ public:
+ typedef boost::shared_ptr<LobbyAction> p;
+
+ LobbyAction(int i = 0) : Base(Types::LobbyAction), index(i) {}
+
+ int index;
+
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int v) {
+ ar & index;
+ }
+ };
+
class GameStart : public Base {
public:
typedef boost::shared_ptr<GameStart> p;