Commit 14437ade authored by Hubert Denkmair's avatar Hubert Denkmair
Browse files

implement botitem protocol changes

parent cd36f002
......@@ -123,3 +123,13 @@ real_t Bot::getSightRadius() const
{
return 50.0f + 15.0f * getSnake()->getSegmentRadius();
}
uint32_t Bot::getFace()
{
return m_lua_bot->getFace();
}
uint32_t Bot::getDogTag()
{
return m_lua_bot->getDogTag();
}
......@@ -93,5 +93,9 @@ class Bot : public IdentifyableObject
std::vector<uint32_t> getColors();
real_t getSightRadius() const;
uint32_t getFace();
uint32_t getDogTag();
};
......@@ -402,17 +402,20 @@ namespace msgpack {
}
};
template <> struct pack< std::shared_ptr<Bot> >
template <> struct pack< std::shared_ptr<Bot>>
{
template <typename Stream> msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, std::shared_ptr<Bot> const& v) const
{
o.pack_array(6);
o.pack_array(9);
o.pack(v->getGUID());
o.pack(v->getName());
o.pack(v->getDatabaseVersionId());
o.pack(v->getFace());
o.pack(v->getDogTag());
o.pack(v->getColors());
o.pack(v->getSnake()->getMass());
o.pack(v->getSnake()->getSegmentRadius());
o.pack(v->getSnake()->getSegments());
o.pack(v->getColors());
o.pack(v->getDatabaseVersionId());
return o;
}
};
......
......@@ -14,6 +14,8 @@ class LuaBot
bool init(std::string &initErrorMessage);
bool step(float &next_heading, bool &boost);
std::vector<uint32_t> getColors() { return m_self.colors; }
uint32_t getFace() { return m_self.getFace(); }
uint32_t getDogTag() { return m_self.getDogTag(); }
private:
Bot& m_bot;
......
Supports Markdown
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