ai_scanner.hpp

Go to the documentation of this file.
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 #include "ai.hpp"
00017 
00021 class AIScanner : public ScriptScanner {
00022 public:
00023   AIScanner();
00024   ~AIScanner();
00025 
00029   bool ImportLibrary(const char *library, const char *class_name, int version, HSQUIRRELVM vm, class AIController *controller);
00030 
00034   void RegisterLibrary(class AILibrary *library);
00035 
00039   void RegisterAI(class AIInfo *info);
00040 
00041   void SetDummyAI(class AIInfo *info) { this->info_dummy = info; }
00042 
00046   class AIInfo *SelectRandomAI() const;
00047 
00051   class AIInfo *FindInfo(const char *name, int version, bool force_exact_match);
00052 
00056   char *GetAIConsoleList(char *p, const char *last, bool newest_only) const;
00057 
00061   char *GetAIConsoleLibraryList(char *p, const char *last) const;
00062 
00066   const AIInfoList *GetAIInfoList() { return &this->info_list; }
00067 
00071   const AIInfoList *GetUniqueAIInfoList() { return &this->info_single_list; }
00072 
00076   void RescanAIDir();
00077 
00078 #if defined(ENABLE_NETWORK)
00079   bool HasAI(const struct ContentInfo *ci, bool md5sum);
00080 #endif
00081 private:
00082   typedef std::map<const char *, class AILibrary *, StringCompare> AILibraryList;
00083 
00087   void ScanAIDir();
00088 
00092   void Reset();
00093 
00094   AIInfo *info_dummy;
00095   AIInfoList info_list;
00096   AIInfoList info_single_list;
00097   AILibraryList library_list;
00098 };
00099 
00100 #endif /* AI_SCANNER_HPP */

Generated on Wed Apr 13 00:47:44 2011 for OpenTTD by  doxygen 1.6.1