ai_scanner.hpp

Go to the documentation of this file.
00001 /* $Id: ai_scanner.hpp 18809 2010-01-15 16:41:15Z 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_SCANNER_HPP
00013 #define AI_SCANNER_HPP
00014 
00015 #include <squirrel.h>
00016 #include "../script/script_scanner.hpp"
00017 #include "../core/string_compare_type.hpp"
00018 #include "ai.hpp"
00019 #include <map>
00020 
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);
00052 
00056   char *GetAIConsoleList(char *p, const char *last) const;
00057 
00061   const AIInfoList *GetAIInfoList() { return &this->info_list; }
00062 
00066   const AIInfoList *GetUniqueAIInfoList() { return &this->info_single_list; }
00067 
00071   void RescanAIDir();
00072 
00073 #if defined(ENABLE_NETWORK)
00074   bool HasAI(const struct ContentInfo *ci, bool md5sum);
00075 #endif
00076 private:
00077   typedef std::map<const char *, class AILibrary *, StringCompare> AILibraryList;
00078 
00082   void ScanAIDir();
00083 
00084   AIInfo *info_dummy;
00085   AIInfoList info_list;
00086   AIInfoList info_single_list;
00087   AILibraryList library_list;
00088 };
00089 
00090 #endif /* AI_SCANNER_HPP */

Generated on Wed Jan 20 23:38:33 2010 for OpenTTD by  doxygen 1.5.6