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 game_scanner.hpp declarations of the class for Game scanner */
10 #ifndef GAME_SCANNER_HPP
11 #define GAME_SCANNER_HPP
13 #include "../script/script_scanner.hpp"
15 class GameScannerInfo
: public ScriptScanner
{
17 void Initialize() override
;
20 * Check if we have a game by name and version available in our list.
21 * @param nameParam The name of the game script.
22 * @param versionParam The version of the game script, or -1 if you want the latest.
23 * @param force_exact_match Only match name+version, never latest.
24 * @return nullptr if no match found, otherwise the game script that matched.
26 class GameInfo
*FindInfo(const char *nameParam
, int versionParam
, bool force_exact_match
);
29 void GetScriptName(ScriptInfo
*info
, char *name
, const char *last
) override
;
30 const char *GetFileName() const override
{ return PATHSEP
"info.nut"; }
31 Subdirectory
GetDirectory() const override
{ return GAME_DIR
; }
32 const char *GetScannerName() const override
{ return "Game Scripts"; }
33 void RegisterAPI(class Squirrel
*engine
) override
;
37 class GameScannerLibrary
: public ScriptScanner
{
39 void Initialize() override
;
42 * Find a library in the pool.
43 * @param library The library name to find.
44 * @param version The version the library should have.
45 * @return The library if found, nullptr otherwise.
47 class GameLibrary
*FindLibrary(const char *library
, int version
);
50 void GetScriptName(ScriptInfo
*info
, char *name
, const char *last
) override
;
51 const char *GetFileName() const override
{ return PATHSEP
"library.nut"; }
52 Subdirectory
GetDirectory() const override
{ return GAME_LIBRARY_DIR
; }
53 const char *GetScannerName() const override
{ return "GS Libraries"; }
54 void RegisterAPI(class Squirrel
*engine
) override
;
57 #endif /* GAME_SCANNER_HPP */