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 name The name of the AI.
31 * @param version 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 std::string
&name
, int version
, bool force_exact_match
);
40 void SetDummyAI(class AIInfo
*info
);
43 std::string
GetScriptName(ScriptInfo
*info
) 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 std::string
&library
, int version
);
66 std::string
GetScriptName(ScriptInfo
*info
) 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 */