Update: Translations from eints
[openttd-github.git] / src / script / api / script_newgrf.hpp
blob7b9b2286c57add1f3aa5a03f5255d4ce9c4251bb
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 script_newgrf.hpp NewGRF info for scripts. */
10 #ifndef SCRIPT_NEWGRF_HPP
11 #define SCRIPT_NEWGRF_HPP
13 #include "script_list.hpp"
15 /**
16 * Create a list of loaded NewGRFs.
17 * @api ai game
18 * @ingroup ScriptList
20 class ScriptNewGRFList : public ScriptList {
21 public:
22 ScriptNewGRFList();
26 /**
27 * Class that handles all NewGRF related functions.
28 * @api ai game
30 class ScriptNewGRF : public ScriptObject {
31 public:
32 /**
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);
39 /**
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);
47 /**
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 */