SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
AIAddNodeMessage.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "IProtocolMessage.h"
7 #include "AIStubTypes.h"
8 
9 namespace ai {
10 
17 private:
18  int32_t _parentNodeId;
19  CharacterId _characterId;
20  std::string _name;
21  std::string _type;
22  std::string _condition;
23 
24 public:
25  AIAddNodeMessage(int32_t parentNodeId, CharacterId characterId, const std::string& name, const std::string& type, const std::string& condition) :
26  IProtocolMessage(PROTO_ADDNODE), _parentNodeId(parentNodeId), _characterId(characterId), _name(name), _type(type), _condition(condition) {
27  }
28 
29  explicit AIAddNodeMessage(streamContainer& in) :
30  IProtocolMessage(PROTO_ADDNODE) {
31  _parentNodeId = readInt(in);
32  _characterId = readInt(in);
33  _name = readString(in);
34  _type = readString(in);
35  _condition = readString(in);
36  }
37 
38  void serialize(streamContainer& out) const override {
39  addByte(out, _id);
40  addInt(out, _parentNodeId);
41  addInt(out, _characterId);
42  addString(out, _name);
43  addString(out, _type);
44  addString(out, _condition);
45  }
46 
47  inline const std::string& getName() const {
48  return _name;
49  }
50 
51  inline const std::string& getType() const {
52  return _type;
53  }
54 
55  inline const std::string& getCondition() const {
56  return _condition;
57  }
58 
59  inline uint32_t getParentNodeId() const {
60  return _parentNodeId;
61  }
62 
63  inline CharacterId getCharacterId() const {
64  return _characterId;
65  }
66 };
67 
68 }
A protocol message is used for the serialization of the ai states for remote debugging.
Definition: IProtocolMessage.h:60
Message for the remote debugging interface.
Definition: AIAddNodeMessage.h:16