00001 /* $Id$ */ 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 #include "../script/script_config.hpp" 00017 00019 class AIInfo : public ScriptInfo { 00020 public: 00021 AIInfo(); 00022 ~AIInfo(); 00023 00027 static void RegisterAPI(Squirrel *engine); 00028 00032 static SQInteger Constructor(HSQUIRRELVM vm); 00033 00037 static SQInteger DummyConstructor(HSQUIRRELVM vm); 00038 00042 bool CanLoadFromVersion(int version) const; 00043 00047 bool UseAsRandomAI() const { return this->use_as_random; } 00048 00052 const char *GetAPIVersion() const { return this->api_version; } 00053 00054 private: 00055 int min_loadable_version; 00056 bool use_as_random; 00057 const char *api_version; 00058 }; 00059 00061 class AILibrary : public ScriptInfo { 00062 public: 00063 AILibrary() : ScriptInfo(), category(NULL) {}; 00064 ~AILibrary(); 00065 00069 static void RegisterAPI(Squirrel *engine); 00070 00074 static SQInteger Constructor(HSQUIRRELVM vm); 00075 00079 const char *GetCategory() const { return this->category; } 00080 00081 private: 00082 const char *category; 00083 }; 00084 00085 #endif /* AI_INFO_HPP */