summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-11-15 08:43:27 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-11-15 08:43:27 +0100
commit7e599c9e515556bf2122bd33f971ef37bbaffd07 (patch)
tree92bcf07118fa739c1cc2120ec912acdcda50c9ba /common
parentc6a83f89ea55ba2071611513ac85b64134ac8f7b (diff)
Added Game-class and GameStart message.
Diffstat (limited to 'common')
-rw-r--r--common/connectionbase.cpp4
-rw-r--r--common/message.cpp12
-rw-r--r--common/message.h10
3 files changed, 26 insertions, 0 deletions
diff --git a/common/connectionbase.cpp b/common/connectionbase.cpp
index c269349..ce23752 100644
--- a/common/connectionbase.cpp
+++ b/common/connectionbase.cpp
@@ -50,6 +50,10 @@ void ConnectionBase::got_data(uint8_t* data, std::size_t bytes) {
m = make_shared<Message::LoginResponse>();
break;
+ case Message::Types::GameStart:
+ m = make_shared<Message::GameStart>();
+ break;
+
default:
throw std::runtime_error("Deserialization attempted on unknown message type.");
}
diff --git a/common/message.cpp b/common/message.cpp
index 8b3dc74..2dd9691 100644
--- a/common/message.cpp
+++ b/common/message.cpp
@@ -63,3 +63,15 @@ std::pair<uint8_t*, std::size_t> Message::LoginResponse::serialize() {
void Message::LoginResponse::deserialize(uint8_t* data, std::size_t bytes) {
login_ok = bool(data[0]);
}
+
+Message::GameStart::GameStart() : Base(Types::GameStart) {
+
+}
+
+std::pair<uint8_t*, std::size_t> Message::GameStart::serialize() {
+ return std::pair<uint8_t*, std::size_t>(0, 0);
+}
+
+void Message::GameStart::deserialize(uint8_t* data, std::size_t bytes) {
+
+}
diff --git a/common/message.h b/common/message.h
index 56096ed..3587229 100644
--- a/common/message.h
+++ b/common/message.h
@@ -80,6 +80,16 @@ namespace Message {
virtual void deserialize(uint8_t* data, std::size_t bytes);
};
+ class GameStart : public Base {
+ public:
+ typedef boost::shared_ptr<LoginResponse> p;
+
+ GameStart();
+
+ virtual std::pair<uint8_t*, std::size_t> serialize();
+ virtual void deserialize(uint8_t* data, std::size_t bytes);
+ };
+
typedef boost::shared_ptr<Base> p;
};