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

add missing convert() functions

parent 85a67069
#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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment