Commit 2ec9bf64 authored by Hubert Denkmair's avatar Hubert Denkmair
Browse files

forward database_id

parent adf4a72e
...@@ -72,6 +72,7 @@ void MsgPackProtocol::to_json(nlohmann::json &j, const MsgPackProtocol::BotItem ...@@ -72,6 +72,7 @@ void MsgPackProtocol::to_json(nlohmann::json &j, const MsgPackProtocol::BotItem
{ {
j = json { j = json {
{"id", item.guid}, {"id", item.guid},
{"db_id", item.database_id},
{"name", item.name}, {"name", item.name},
{"segment_radius", item.segment_radius}, {"segment_radius", item.segment_radius},
{"color", item.color}, {"color", item.color},
......
...@@ -49,6 +49,7 @@ namespace MsgPackProtocol ...@@ -49,6 +49,7 @@ namespace MsgPackProtocol
real_t segment_radius; real_t segment_radius;
std::vector<SnakeSegmentItem> segments; std::vector<SnakeSegmentItem> segments;
std::vector<uint32_t> color; std::vector<uint32_t> color;
int database_id;
}; };
struct Message struct Message
...@@ -513,12 +514,13 @@ namespace msgpack { ...@@ -513,12 +514,13 @@ namespace msgpack {
msgpack::object const& operator()(msgpack::object const& o, MsgPackProtocol::BotItem& v) const msgpack::object const& operator()(msgpack::object const& o, MsgPackProtocol::BotItem& v) const
{ {
if (o.type != msgpack::type::ARRAY) throw msgpack::type_error(); if (o.type != msgpack::type::ARRAY) throw msgpack::type_error();
if (o.via.array.size != 5) throw msgpack::type_error(); if (o.via.array.size != 6) throw msgpack::type_error();
o.via.array.ptr[0] >> v.guid; o.via.array.ptr[0] >> v.guid;
o.via.array.ptr[1] >> v.name; o.via.array.ptr[1] >> v.name;
o.via.array.ptr[2] >> v.segment_radius; o.via.array.ptr[2] >> v.segment_radius;
o.via.array.ptr[3] >> v.segments; o.via.array.ptr[3] >> v.segments;
o.via.array.ptr[4] >> v.color; o.via.array.ptr[4] >> v.color;
o.via.array.ptr[5] >> v.database_id;
for (auto &segmentItem: v.segments) for (auto &segmentItem: v.segments)
{ {
segmentItem.bot_id = v.guid; segmentItem.bot_id = v.guid;
......
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