ai_scanner.hpp

Go to the documentation of this file.
00001 /* $Id: ai_scanner.hpp 24900 2013-01-08 22:46:42Z planetmaker $ */
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();
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:
00057   /* virtual */ void Initialize();
00058 
00065   class AILibrary *FindLibrary(const char *library, int version);
00066 
00067 protected:
00068   /* virtual */ void GetScriptName(ScriptInfo *info, char *name, int len);
00069   /* virtual */ const char *GetFileName() const { return PATHSEP "library.nut"; }
00070   /* virtual */ Subdirectory GetDirectory() const { return AI_LIBRARY_DIR; }
00071   /* virtual */ const char *GetScannerName() const { return "AI Libraries"; }
00072   /* virtual */ void RegisterAPI(class Squirrel *engine);
00073 };
00074 
00075 #endif /* AI_SCANNER_HPP */