Fix #10490: Allow ships to exit depots if another is not moving at the exit point...
[openttd-github.git] / src / ai / ai_info.hpp
blobdf8e6b65d7e893d8889f34f9e6073d53cde870cc
1 /*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
8 /** @file ai_info.hpp AIInfo keeps track of all information of an AI, like Author, Description, ... */
10 #ifndef AI_INFO_HPP
11 #define AI_INFO_HPP
13 #include "../script/script_info.hpp"
15 /** All static information from an AI like name, version, etc. */
16 class AIInfo : public ScriptInfo {
17 public:
18 AIInfo();
20 /**
21 * Register the functions of this class.
23 static void RegisterAPI(Squirrel *engine);
25 /**
26 * Create an AI, using this AIInfo as start-template.
28 static SQInteger Constructor(HSQUIRRELVM vm);
30 /**
31 * Create a dummy-AI.
33 static SQInteger DummyConstructor(HSQUIRRELVM vm);
35 /**
36 * Check if we can start this AI.
38 bool CanLoadFromVersion(int version) const;
40 /**
41 * Use this AI as a random AI.
43 bool UseAsRandomAI() const { return this->use_as_random; }
45 /**
46 * Get the API version this AI is written for.
48 const std::string &GetAPIVersion() const { return this->api_version; }
50 private:
51 int min_loadable_version; ///< The AI can load savegame data if the version is equal or greater than this.
52 bool use_as_random; ///< Should this AI be used when the user wants a "random AI"?
53 std::string api_version; ///< API version used by this AI.
56 /** All static information from an AI library like name, version, etc. */
57 class AILibrary : public ScriptInfo {
58 public:
59 AILibrary() : ScriptInfo() {};
61 /**
62 * Register the functions of this class.
64 static void RegisterAPI(Squirrel *engine);
66 /**
67 * Create an AI, using this AIInfo as start-template.
69 static SQInteger Constructor(HSQUIRRELVM vm);
71 /**
72 * Get the category this library is in.
74 const std::string &GetCategory() const { return this->category; }
76 private:
77 std::string category; ///< The category this library is in.
80 #endif /* AI_INFO_HPP */