00001 /* $Id: ai_info.hpp 23735 2012-01-03 20:26:05Z rubidium $ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * 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. 00006 * 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. 00007 * 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/>. 00008 */ 00009 00012 #ifndef AI_INFO_HPP 00013 #define AI_INFO_HPP 00014 00015 #include "../script/script_info.hpp" 00016 00018 class AIInfo : public ScriptInfo { 00019 public: 00020 AIInfo(); 00021 ~AIInfo(); 00022 00026 static void RegisterAPI(Squirrel *engine); 00027 00031 static SQInteger Constructor(HSQUIRRELVM vm); 00032 00036 static SQInteger DummyConstructor(HSQUIRRELVM vm); 00037 00041 bool CanLoadFromVersion(int version) const; 00042 00046 bool UseAsRandomAI() const { return this->use_as_random; } 00047 00051 const char *GetAPIVersion() const { return this->api_version; } 00052 00053 private: 00054 int min_loadable_version; 00055 bool use_as_random; 00056 const char *api_version; 00057 }; 00058 00060 class AILibrary : public ScriptInfo { 00061 public: 00062 AILibrary() : ScriptInfo(), category(NULL) {}; 00063 ~AILibrary(); 00064 00068 static void RegisterAPI(Squirrel *engine); 00069 00073 static SQInteger Constructor(HSQUIRRELVM vm); 00074 00078 const char *GetCategory() const { return this->category; } 00079 00080 private: 00081 const char *category; 00082 }; 00083 00084 #endif /* AI_INFO_HPP */