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/>.
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
{
22 /* virtual */ void Initialize();
26 * @return A random AI from the pool.
28 class AIInfo
*SelectRandomAI() const;
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
);
42 void SetDummyAI(class AIInfo
*info
);
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
);
52 AIInfo
*info_dummy
; ///< The dummy AI.
55 class AIScannerLibrary
: public ScriptScanner
{
57 /* virtual */ void Initialize();
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
);
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 */