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 
00045   void SetDummyAI(class AIInfo *info) { this->info_dummy = info; }
00046 
00050   class AIInfo *SelectRandomAI() const;
00051 
00055   class AIInfo *FindInfo(const char *name, int version, bool force_exact_match);
00056 
00060   char *GetAIConsoleList(char *p, const char *last, bool newest_only) const;
00061 
00065   char *GetAIConsoleLibraryList(char *p, const char *last) const;
00066 
00070   const AIInfoList *GetAIInfoList() { return &this->info_list; }
00071 
00075   const AIInfoList *GetUniqueAIInfoList() { return &this->info_single_list; }
00076 
00080   void RescanAIDir();
00081 
00082 #if defined(ENABLE_NETWORK)
00083   bool HasAI(const struct ContentInfo *ci, bool md5sum);
00084 #endif
00085 private:
00086   typedef std::map<const char *, class AILibrary *, StringCompare> AILibraryList; 
00087 
00091   void ScanAIDir();
00092 
00096   void Reset();
00097 
00098   AIInfo *info_dummy;          
00099   AIInfoList info_list;        
00100   AIInfoList info_single_list; 
00101   AILibraryList library_list;  
00102 };
00103 
00104 #endif /* AI_SCANNER_HPP */

Generated on Fri May 27 04:19:38 2011 for OpenTTD by  doxygen 1.6.1