(svn r27756) -Codechange: Add StringTab enum
[openttd.git] / src / ai / ai_scanner.hpp
blobd8e8a6993deb6ea6b726e203f7d864a2fbdc26b4
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file ai_scanner.hpp declarations of the class for AI scanner */
12 #ifndef AI_SCANNER_HPP
13 #define AI_SCANNER_HPP
15 #include "../script/script_scanner.hpp"
17 class AIScannerInfo : public ScriptScanner {
18 public:
19 AIScannerInfo();
20 ~AIScannerInfo();
22 /* virtual */ void Initialize();
24 /**
25 * Select a random AI.
26 * @return A random AI from the pool.
28 class AIInfo *SelectRandomAI() const;
30 /**
31 * Check if we have an AI by name and version available in our list.
32 * @param nameParam The name of the AI.
33 * @param versionParam The version of the AI, or -1 if you want the latest.
34 * @param force_exact_match Only match name+version, never latest.
35 * @return NULL if no match found, otherwise the AI that matched.
37 class AIInfo *FindInfo(const char *nameParam, int versionParam, bool force_exact_match);
39 /**
40 * Set the Dummy AI.
42 void SetDummyAI(class AIInfo *info);
44 protected:
45 /* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
46 /* virtual */ const char *GetFileName() const { return PATHSEP "info.nut"; }
47 /* virtual */ Subdirectory GetDirectory() const { return AI_DIR; }
48 /* virtual */ const char *GetScannerName() const { return "AIs"; }
49 /* virtual */ void RegisterAPI(class Squirrel *engine);
51 private:
52 AIInfo *info_dummy; ///< The dummy AI.
55 class AIScannerLibrary : public ScriptScanner {
56 public:
57 /* virtual */ void Initialize();
59 /**
60 * Find a library in the pool.
61 * @param library The library name to find.
62 * @param version The version the library should have.
63 * @return The library if found, NULL otherwise.
65 class AILibrary *FindLibrary(const char *library, int version);
67 protected:
68 /* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
69 /* virtual */ const char *GetFileName() const { return PATHSEP "library.nut"; }
70 /* virtual */ Subdirectory GetDirectory() const { return AI_LIBRARY_DIR; }
71 /* virtual */ const char *GetScannerName() const { return "AI Libraries"; }
72 /* virtual */ void RegisterAPI(class Squirrel *engine);
75 #endif /* AI_SCANNER_HPP */