diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-06-12 15:41:08 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-06-12 15:41:08 +0200 |
commit | 1f97ccdac792c0b5b07972e7d4b2f28416046ea8 (patch) | |
tree | 12ef8fe802ad47ade4a24c88bd235d47e9869d82 /messages.h | |
parent | 042055b251bba4d8a59e16ca47721543cae346cd (diff) |
Added MSG_TYPE_PLAYER with id, name and position.
Diffstat (limited to 'messages.h')
-rw-r--r-- | messages.h | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -1,6 +1,8 @@ #ifndef MESSAGES_H #define MESSAGES_H +#include "vector.h" + #include <boost/asio.hpp> namespace message { @@ -10,7 +12,8 @@ enum MessageType { MSG_TYPE_HELLO, MSG_TYPE_POS, MSG_TYPE_CHUNK, - MSG_TYPE_MSG + MSG_TYPE_MSG, + MSG_TYPE_PLAYER }; class MessageBase { @@ -75,6 +78,23 @@ class Message : public MessageBase { std::string get_str(); }; +class Player : public MessageBase { + protected: + uint32_t id; + uint16_t str_len; + bool got_len; + + public: + Player(); + Player(uint32_t id, Vector3 pos, std::string name); + + virtual std::size_t payload_size(); + uint32_t get_id(); + Vector3 get_pos(); + uint16_t get_len(); + std::string get_str(); +}; + } #endif |