diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/connectionbase.cpp | 22 | ||||
-rw-r--r-- | common/message.h | 28 |
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; |