From 272f4f8b4b12e4d732b1a5adaa37b318c0058675 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Tue, 30 Nov 2010 23:59:09 +0100 Subject: Add LobbyStatus and LobbyAction messages. --- common/connectionbase.cpp | 22 ++++++++++++++++++++++ common/message.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) 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(); + ia & m; + got_message(m); + } break; + + case Message::Types::LobbyAction: { + Message::LobbyAction::p m = make_shared(); + ia & m; + got_message(m); + } break; + case Message::Types::GameStart: { Message::GameStart::p m = make_shared(); 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(msg); + oa & m; + } break; + + case Message::Types::LobbyAction: { + Message::LobbyAction::p m = dynamic_pointer_cast(msg); + oa & m; + } break; + case Message::Types::GameStart: { Message::GameStart::p m = dynamic_pointer_cast(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 p; + + LobbyStatus() : Base(Types::LobbyStatus) {} + + std::vector game_modes; + + template + void serialize(Archive & ar, const unsigned int v) { + ar & game_modes; + } + }; + + class LobbyAction : public Base { + public: + typedef boost::shared_ptr p; + + LobbyAction(int i = 0) : Base(Types::LobbyAction), index(i) {} + + int index; + + template + void serialize(Archive & ar, const unsigned int v) { + ar & index; + } + }; + class GameStart : public Base { public: typedef boost::shared_ptr p; -- cgit v1.2.3