2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 /** @file ai_scanner.hpp declarations of the class for AI scanner */
10 #ifndef AI_SCANNER_HPP
11 #define AI_SCANNER_HPP
13 #include "../script/script_scanner.hpp"
15 class AIScannerInfo
: public ScriptScanner
{
20 void Initialize() override
;
24 * @return A random AI from the pool.
26 class AIInfo
*SelectRandomAI() const;
29 * Check if we have an AI by name and version available in our list.
30 * @param nameParam The name of the AI.
31 * @param versionParam The version of the AI, or -1 if you want the latest.
32 * @param force_exact_match Only match name+version, never latest.
33 * @return nullptr if no match found, otherwise the AI that matched.
35 class AIInfo
*FindInfo(const char *nameParam
, int versionParam
, bool force_exact_match
);
40 void SetDummyAI(class AIInfo
*info
);
43 void GetScriptName(ScriptInfo
*info
, char *name
, const char *last
) override
;
44 const char *GetFileName() const override
{ return PATHSEP
"info.nut"; }
45 Subdirectory
GetDirectory() const override
{ return AI_DIR
; }
46 const char *GetScannerName() const override
{ return "AIs"; }
47 void RegisterAPI(class Squirrel
*engine
) override
;
50 AIInfo
*info_dummy
; ///< The dummy AI.
53 class AIScannerLibrary
: public ScriptScanner
{
55 void Initialize() override
;
58 * Find a library in the pool.
59 * @param library The library name to find.
60 * @param version The version the library should have.
61 * @return The library if found, nullptr otherwise.
63 class AILibrary
*FindLibrary(const char *library
, int version
);
66 void GetScriptName(ScriptInfo
*info
, char *name
, const char *last
) override
;
67 const char *GetFileName() const override
{ return PATHSEP
"library.nut"; }
68 Subdirectory
GetDirectory() const override
{ return AI_LIBRARY_DIR
; }
69 const char *GetScannerName() const override
{ return "AI Libraries"; }
70 void RegisterAPI(class Squirrel
*engine
) override
;
73 #endif /* AI_SCANNER_HPP */