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_SCANNER_HPP 00013 #define AI_SCANNER_HPP 00014 00015 #include "../script/script_scanner.hpp" 00016 00017 class AIScannerInfo : public ScriptScanner { 00018 public: 00019 AIScannerInfo(); 00020 ~AIScannerInfo(); 00021 00022 /* virtual */ void Initialize(const char *name); 00023 00028 class AIInfo *SelectRandomAI() const; 00029 00037 class AIInfo *FindInfo(const char *nameParam, int versionParam, bool force_exact_match); 00038 00042 void SetDummyAI(class AIInfo *info); 00043 00044 protected: 00045 /* virtual */ void GetScriptName(ScriptInfo *info, char *name, int len); 00046 /* virtual */ const char *GetFileName() const { return PATHSEP "info.nut"; } 00047 /* virtual */ Subdirectory GetDirectory() const { return AI_DIR; } 00048 /* virtual */ const char *GetScannerName() const { return "AIs"; } 00049 /* virtual */ void RegisterAPI(class Squirrel *engine); 00050 00051 private: 00052 AIInfo *info_dummy; 00053 }; 00054 00055 class AIScannerLibrary : public ScriptScanner { 00056 public: 00063 class AILibrary *FindLibrary(const char *library, int version); 00064 00065 protected: 00066 /* virtual */ void GetScriptName(ScriptInfo *info, char *name, int len); 00067 /* virtual */ const char *GetFileName() const { return PATHSEP "library.nut"; } 00068 /* virtual */ Subdirectory GetDirectory() const { return AI_LIBRARY_DIR; } 00069 /* virtual */ const char *GetScannerName() const { return "AI Libraries"; } 00070 /* virtual */ void RegisterAPI(class Squirrel *engine); 00071 }; 00072 00073 #endif /* AI_SCANNER_HPP */