Fix: Don't allow right-click to close world generation progress window. (#13084)
[openttd-github.git] / src / ai / ai_scanner.hpp
bloba2c8a7280e73530e6b26d90b20255f40155e991a
1 /*
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/>.
6 */
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 {
16 public:
17 AIScannerInfo();
18 ~AIScannerInfo();
20 void Initialize() override;
22 /**
23 * Select a random AI.
24 * @return A random AI from the pool.
26 class AIInfo *SelectRandomAI() const;
28 /**
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);
37 /**
38 * Set the Dummy AI.
40 void SetDummyAI(class AIInfo *info);
42 protected:
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;
49 private:
50 AIInfo *info_dummy; ///< The dummy AI.
53 class AIScannerLibrary : public ScriptScanner {
54 public:
55 void Initialize() override;
57 /**
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);
65 protected:
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 */