2011-12-19 20:55:56 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @file game_scanner.hpp declarations of the class for Game scanner */
|
|
|
|
|
|
|
|
#ifndef GAME_SCANNER_HPP
|
|
|
|
#define GAME_SCANNER_HPP
|
|
|
|
|
|
|
|
#include "../script/script_scanner.hpp"
|
|
|
|
|
|
|
|
class GameScannerInfo : public ScriptScanner {
|
|
|
|
public:
|
2019-03-03 22:25:13 +00:00
|
|
|
void Initialize() override;
|
2011-12-19 20:55:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if we have a game by name and version available in our list.
|
|
|
|
* @param nameParam The name of the game script.
|
2013-01-08 22:46:42 +00:00
|
|
|
* @param versionParam The version of the game script, or -1 if you want the latest.
|
2011-12-19 20:55:56 +00:00
|
|
|
* @param force_exact_match Only match name+version, never latest.
|
2019-04-10 21:07:06 +00:00
|
|
|
* @return nullptr if no match found, otherwise the game script that matched.
|
2011-12-19 20:55:56 +00:00
|
|
|
*/
|
|
|
|
class GameInfo *FindInfo(const char *nameParam, int versionParam, bool force_exact_match);
|
|
|
|
|
|
|
|
protected:
|
2019-03-03 22:25:13 +00:00
|
|
|
void GetScriptName(ScriptInfo *info, char *name, const char *last) override;
|
|
|
|
const char *GetFileName() const override { return PATHSEP "info.nut"; }
|
|
|
|
Subdirectory GetDirectory() const override { return GAME_DIR; }
|
|
|
|
const char *GetScannerName() const override { return "Game Scripts"; }
|
|
|
|
void RegisterAPI(class Squirrel *engine) override;
|
2011-12-19 20:55:56 +00:00
|
|
|
};
|
|
|
|
|
2011-12-19 20:56:59 +00:00
|
|
|
|
|
|
|
class GameScannerLibrary : public ScriptScanner {
|
|
|
|
public:
|
2019-03-03 22:25:13 +00:00
|
|
|
void Initialize() override;
|
2011-12-19 20:56:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Find a library in the pool.
|
|
|
|
* @param library The library name to find.
|
|
|
|
* @param version The version the library should have.
|
2019-04-10 21:07:06 +00:00
|
|
|
* @return The library if found, nullptr otherwise.
|
2011-12-19 20:56:59 +00:00
|
|
|
*/
|
|
|
|
class GameLibrary *FindLibrary(const char *library, int version);
|
|
|
|
|
|
|
|
protected:
|
2019-03-03 22:25:13 +00:00
|
|
|
void GetScriptName(ScriptInfo *info, char *name, const char *last) override;
|
|
|
|
const char *GetFileName() const override { return PATHSEP "library.nut"; }
|
|
|
|
Subdirectory GetDirectory() const override { return GAME_LIBRARY_DIR; }
|
|
|
|
const char *GetScannerName() const override { return "GS Libraries"; }
|
|
|
|
void RegisterAPI(class Squirrel *engine) override;
|
2011-12-19 20:56:59 +00:00
|
|
|
};
|
|
|
|
|
2011-12-19 20:55:56 +00:00
|
|
|
#endif /* GAME_SCANNER_HPP */
|