(svn r28004) -Update from Eints:
[openttd.git] / src / ai / ai_info.hpp
blob51cfb7d8a0bdcc05511d30846458ba4212f6bc0e
1 /* $Id$ */
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 */
10 /** @file ai_info.hpp AIInfo keeps track of all information of an AI, like Author, Description, ... */
12 #ifndef AI_INFO_HPP
13 #define AI_INFO_HPP
15 #include "../script/script_info.hpp"
17 /** All static information from an AI like name, version, etc. */
18 class AIInfo : public ScriptInfo {
19 public:
20 AIInfo();
21 ~AIInfo();
23 /**
24 * Register the functions of this class.
26 static void RegisterAPI(Squirrel *engine);
28 /**
29 * Create an AI, using this AIInfo as start-template.
31 static SQInteger Constructor(HSQUIRRELVM vm);
33 /**
34 * Create a dummy-AI.
36 static SQInteger DummyConstructor(HSQUIRRELVM vm);
38 /**
39 * Check if we can start this AI.
41 bool CanLoadFromVersion(int version) const;
43 /**
44 * Use this AI as a random AI.
46 bool UseAsRandomAI() const { return this->use_as_random; }
48 /**
49 * Get the API version this AI is written for.
51 const char *GetAPIVersion() const { return this->api_version; }
53 private:
54 int min_loadable_version; ///< The AI can load savegame data if the version is equal or greater than this.
55 bool use_as_random; ///< Should this AI be used when the user wants a "random AI"?
56 const char *api_version; ///< API version used by this AI.
59 /** All static information from an AI library like name, version, etc. */
60 class AILibrary : public ScriptInfo {
61 public:
62 AILibrary() : ScriptInfo(), category(NULL) {};
63 ~AILibrary();
65 /**
66 * Register the functions of this class.
68 static void RegisterAPI(Squirrel *engine);
70 /**
71 * Create an AI, using this AIInfo as start-template.
73 static SQInteger Constructor(HSQUIRRELVM vm);
75 /**
76 * Get the category this library is in.
78 const char *GetCategory() const { return this->category; }
80 private:
81 const char *category; ///< The category this library is in.
84 #endif /* AI_INFO_HPP */