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 script_newgrf.hpp NewGRF info for scripts. */
10 #ifndef SCRIPT_NEWGRF_HPP
11 #define SCRIPT_NEWGRF_HPP
13 #include "script_list.hpp"
16 * Create a list of loaded NewGRFs.
20 class ScriptNewGRFList
: public ScriptList
{
27 * Class that handles all NewGRF related functions.
30 class ScriptNewGRF
: public ScriptObject
{
33 * Check if a NewGRF with a given grfid is loaded.
34 * @param grfid The grfid to check.
35 * @return True if and only if a NewGRF with the given grfid is loaded in the game.
37 static bool IsLoaded(SQInteger grfid
);
40 * Get the version of a loaded NewGRF.
41 * @param grfid The NewGRF to query.
42 * @pre ScriptNewGRF::IsLoaded(grfid).
43 * @return Version of the NewGRF or 0 if the NewGRF specifies no version.
45 static SQInteger
GetVersion(SQInteger grfid
);
48 * Get the name of a loaded NewGRF.
49 * @param grfid The NewGRF to query.
50 * @pre ScriptNewGRF::IsLoaded(grfid).
51 * @return The name of the NewGRF or null if no name is defined.
53 static std::optional
<std::string
> GetName(SQInteger grfid
);
56 #endif /* SCRIPT_NEWGRF_HPP */