summaryrefslogtreecommitdiff
path: root/messages.h
diff options
context:
space:
mode:
Diffstat (limited to 'messages.h')
-rw-r--r--messages.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/messages.h b/messages.h
index f1625f8..f388805 100644
--- a/messages.h
+++ b/messages.h
@@ -25,12 +25,22 @@ class MessageBase {
static inline void read(boost::asio::ip::tcp::socket& socket, T& v) {
boost::asio::read(socket, boost::asio::buffer(&v, sizeof(T)));
}
+ static inline void read(boost::asio::ip::tcp::socket& socket, Vector3& pos) {
+ read(socket, pos.x);
+ read(socket, pos.y);
+ read(socket, pos.z);
+ }
static std::string read_string(boost::asio::ip::tcp::socket& socket);
template<typename T>
static inline void write(boost::asio::ip::tcp::socket& socket, T& v) {
boost::asio::write(socket, boost::asio::buffer(&v, sizeof(T)));
}
+ static inline void write(boost::asio::ip::tcp::socket& socket, Vector3& pos) {
+ write(socket, pos.x);
+ write(socket, pos.y);
+ write(socket, pos.z);
+ }
static void write_string(boost::asio::ip::tcp::socket& socket, std::string str);