Commit 882d4870 authored by Hubert Denkmair's avatar Hubert Denkmair
Browse files

add missing convert() functions

parent 85a67069
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
#pragma once

#include <cstdint>
#include <vector>
#include <msgpack.hpp>

@@ -166,6 +165,17 @@ namespace msgpack {
				}
			};

			template<> struct convert<MsgPackProtocol::PlayerInfoMessage>
			{
				msgpack::object const& operator()(msgpack::object const& o, MsgPackProtocol::PlayerInfoMessage& v) const
				{
					if (o.type != msgpack::type::ARRAY) throw msgpack::type_error();
					if (o.via.array.size != 3) throw msgpack::type_error();
					o.via.array.ptr[2] >> v.player_id;
					return o;
				}
			};

			template <> struct pack<MsgPackProtocol::TickMessage>
			{
				template <typename Stream> msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, MsgPackProtocol::TickMessage const& v) const
@@ -178,6 +188,17 @@ namespace msgpack {
				}
			};

			template<> struct convert<MsgPackProtocol::TickMessage>
			{
				msgpack::object const& operator()(msgpack::object const& o, MsgPackProtocol::TickMessage& v) const
				{
					if (o.type != msgpack::type::ARRAY) throw msgpack::type_error();
					if (o.via.array.size != 3) throw msgpack::type_error();
					o.via.array.ptr[2] >> v.frame_id;
					return o;
				}
			};

			template <> struct pack<MsgPackProtocol::WorldUpdateMessage>
			{
				template <typename Stream> msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, MsgPackProtocol::WorldUpdateMessage const& v) const