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

forward database_id

parent adf4a72e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ void MsgPackProtocol::to_json(nlohmann::json &j, const MsgPackProtocol::BotItem
{
	j = json {
		{"id", item.guid},
		{"db_id", item.database_id},
		{"name", item.name},
		{"segment_radius", item.segment_radius},
		{"color", item.color},
+3 −1
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ namespace MsgPackProtocol
		real_t segment_radius;
		std::vector<SnakeSegmentItem> segments;
		std::vector<uint32_t> color;
		int database_id;
	};

	struct Message
@@ -513,12 +514,13 @@ namespace msgpack {
				msgpack::object const& operator()(msgpack::object const& o, MsgPackProtocol::BotItem& v) const
				{
					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[1] >> v.name;
					o.via.array.ptr[2] >> v.segment_radius;
					o.via.array.ptr[3] >> v.segments;
					o.via.array.ptr[4] >> v.color;
					o.via.array.ptr[5] >> v.database_id;
					for (auto &segmentItem: v.segments)
					{
						segmentItem.bot_id = v.guid;