ai_scanner.hpp

Go to the documentation of this file.
00001 /* $Id: ai_scanner.hpp 21703 2011-01-03 14:52:30Z yexo $ */
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 
00024 class AIScanner : public ScriptScanner {
00025 public:
00026   AIScanner();
00027   ~AIScanner();
00028 
00032   bool ImportLibrary(const char *library, const char *class_name, int version, HSQUIRRELVM vm, class AIController *controller);
00033 
00037   void RegisterLibrary(class AILibrary *library);
00038 
00042   void RegisterAI(class AIInfo *info);
00043 
00044   void SetDummyAI(class AIInfo *info) { this->info_dummy = info; }
00045 
00049   class AIInfo *SelectRandomAI() const;
00050 
00054   class AIInfo *FindInfo(const char *name, int version, bool force_exact_match);
00055 
00059   char *GetAIConsoleList(char *p, const char *last) const;
00060 
00064   char *GetAIConsoleLibraryList(char *p, const char *last) const;
00065 
00069   const AIInfoList *GetAIInfoList() { return &this->info_list; }
00070 
00074   const AIInfoList *GetUniqueAIInfoList() { return &this->info_single_list; }
00075 
00079   void RescanAIDir();
00080 
00081 #if defined(ENABLE_NETWORK)
00082   bool HasAI(const struct ContentInfo *ci, bool md5sum);
00083 #endif
00084 private:
00085   typedef std::map<const char *, class AILibrary *, StringCompare> AILibraryList;
00086 
00090   void ScanAIDir();
00091 
00095   void Reset();
00096 
00097   AIInfo *info_dummy;
00098   AIInfoList info_list;
00099   AIInfoList info_single_list;
00100   AILibraryList library_list;
00101 };
00102 
00103 #endif /* AI_SCANNER_HPP */

Generated on Thu Jan 20 22:57:30 2011 for OpenTTD by  doxygen 1.6.1