Add: INR currency (#8136)
[openttd-github.git] / src / game / game_config.cpp
blob89283129e7665de4f417f86ed4036df411367dff
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 game_config.cpp Implementation of GameConfig. */
10 #include "../stdafx.h"
11 #include "../settings_type.h"
12 #include "game.hpp"
13 #include "game_config.hpp"
14 #include "game_info.hpp"
16 #include "../safeguards.h"
18 /* static */ GameConfig *GameConfig::GetConfig(ScriptSettingSource source)
20 GameConfig **config;
21 if (source == SSS_FORCE_NEWGAME || (source == SSS_DEFAULT && _game_mode == GM_MENU)) {
22 config = &_settings_newgame.game_config;
23 } else {
24 config = &_settings_game.game_config;
26 if (*config == nullptr) *config = new GameConfig();
27 return *config;
30 class GameInfo *GameConfig::GetInfo() const
32 return static_cast<class GameInfo *>(ScriptConfig::GetInfo());
35 ScriptInfo *GameConfig::FindInfo(const char *name, int version, bool force_exact_match)
37 return static_cast<ScriptInfo *>(Game::FindInfo(name, version, force_exact_match));
40 bool GameConfig::ResetInfo(bool force_exact_match)
42 this->info = (ScriptInfo *)Game::FindInfo(this->name, force_exact_match ? this->version : -1, force_exact_match);
43 return this->info != nullptr;