19 typedef std::vector<AIStateWorld> States;
22 void readState (streamContainer& in) {
23 const ai::CharacterId
id = readInt(in);
24 const float x = readFloat(in);
25 const float y = readFloat(in);
26 const float z = readFloat(in);
27 const float orientation = readFloat(in);
28 const glm::vec3 position(x, y, z);
32 readAttributes(in, attributes);
33 _states.push_back(tree);
36 void writeState (streamContainer& out,
const AIStateWorld& state)
const {
37 addInt(out, state.
getId());
39 addFloat(out, position.x);
40 addFloat(out, position.y);
41 addFloat(out, position.z);
46 void writeAttributes(streamContainer& out,
const CharacterAttributes& attributes)
const {
47 addShort(out, static_cast<int16_t>(attributes.size()));
48 for (CharacterAttributes::const_iterator i = attributes.begin(); i != attributes.end(); ++i) {
49 addString(out, i->first);
50 addString(out, i->second);
54 void readAttributes(streamContainer& in, CharacterAttributes& attributes)
const {
55 const int size = readShort(in);
56 attributes.reserve(size);
57 for (
int i = 0; i < size; ++i) {
58 const std::string& key = readString(in);
59 const std::string& value = readString(in);
60 attributes.insert(std::make_pair(key, value));
71 const int treeSize = readInt(in);
72 for (
int i = 0; i < treeSize; ++i) {
78 _states.push_back(tree);
82 _states.push_back(std::move(tree));
85 void serialize(streamContainer& out)
const override {
87 addInt(out, static_cast<int>(_states.size()));
88 for (States::const_iterator i = _states.begin(); i != _states.end(); ++i) {
93 inline const std::vector<AIStateWorld>& getStates()
const {
float getOrientation() const
Definition: AIStubTypes.h:215
This is a representation of a character state for the serialization.
Definition: AIStubTypes.h:174
A protocol message is used for the serialization of the ai states for remote debugging.
Definition: IProtocolMessage.h:60
const ai::CharacterId & getId() const
Definition: AIStubTypes.h:206
Message for the remote debugging interface.
Definition: AIStateMessage.h:17
const CharacterAttributes & getAttributes() const
Definition: AIStubTypes.h:229
const glm::vec3 & getPosition() const
Definition: AIStubTypes.h:222