OpenTTD
ai_instance.hpp
Go to the documentation of this file.
1 /* $Id$ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef AI_INSTANCE_HPP
13 #define AI_INSTANCE_HPP
14 
15 #include "../script/script_instance.hpp"
16 
18 class AIInstance : public ScriptInstance {
19 public:
20  AIInstance();
21 
26  void Initialize(class AIInfo *info);
27 
28  int GetSetting(const char *name) override;
29  ScriptInfo *FindLibrary(const char *library, int version) override;
30 
31 private:
32  void RegisterAPI() override;
33  void Died() override;
35  void LoadDummyScript() override;
36 };
37 
38 #endif /* AI_INSTANCE_HPP */
Runtime information about an AI like a pointer to the squirrel vm and the current state...
Definition: ai_instance.hpp:18
void Died() override
Tell the script it died.
void CommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
Define a callback function for the client, after the command is finished.
Definition: command_type.h:472
All static information from an Script like name, version, etc.
Definition: script_info.hpp:32
Runtime information about a script like a pointer to the squirrel vm and the current state...
void Initialize(class AIInfo *info)
Initialize the AI and prepare it for its first run.
Definition: ai_instance.cpp:92
void RegisterAPI() override
Register all API functions to the VM.
void LoadDummyScript() override
Load the dummy script.
All static information from an AI like name, version, etc.
Definition: ai_info.hpp:18
int GetSetting(const char *name) override
Get the value of a setting of the current instance.
CommandCallback * GetDoCommandCallback() override
Get the callback handling DoCommands in case of networking.
ScriptInfo * FindLibrary(const char *library, int version) override
Find a library.