SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
DeleteNodeHandler.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "IProtocolHandler.h"
7 #include "AIDeleteNodeMessage.h"
8 #include "Server.h"
9 
10 namespace ai {
11 
12 class Server;
13 
15 private:
16  Server& _server;
17 public:
18  explicit DeleteNodeHandler(Server& server) : _server(server) {
19  }
20 
21  void execute(const ClientId& /*clientId*/, const IProtocolMessage& message) override {
22  const AIDeleteNodeMessage& msg = static_cast<const AIDeleteNodeMessage&>(message);
23  if (!_server.deleteNode(msg.getCharacterId(), msg.getNodeId())) {
24  ai_log_error("Failed to delete the node %u", msg.getNodeId());
25  }
26  }
27 };
28 
29 }
bool deleteNode(const CharacterId &characterId, int32_t nodeId)
Delete the specified node from the ICharacter's behaviour tree and all the other characters that are ...
Definition: ServerImpl.h:400
#define ai_log_error(...)
Logging macro to provide your own loggers.
Definition: Types.h:23
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: AIDeleteNodeMessage.h:16
Interface for the execution of assigned IProtocolMessage.
Definition: IProtocolHandler.h:19
Definition: DeleteNodeHandler.h:14
The server can serialize the state of the AI and broadcast it to all connected clients.
Definition: Server.h:50