Mercurial > hg > openttd
changeset 19855:bc1a33f760f3 draft
(svn r24788) -Change: Detach script settings from difficulty settings. Always allow changing all script settings without setting difficulty to custom.
author | frosch <frosch@openttd.org> |
---|---|
date | Wed, 05 Dec 2012 19:35:38 +0000 |
parents | 376fe8400147 |
children | 74b60883eeca |
files | src/ai/ai_config.cpp src/ai/ai_gui.cpp src/script/script_config.cpp |
diffstat | 3 files changed, 1 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ai/ai_config.cpp +++ b/src/ai/ai_config.cpp @@ -80,7 +80,7 @@ { if (this->info == NULL) { SettingValueList::const_iterator it = this->settings.find(name); - if (it == this->settings.end() || GetGameSettings().difficulty.diff_level != SP_CUSTOM) { + if (it == this->settings.end()) { assert(strcmp("start_date", name) == 0); switch (GetGameSettings().difficulty.diff_level) { case SP_EASY: return AI::START_NEXT_EASY;
--- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -416,21 +416,6 @@ } } - /** - * Check whether we modified the difficulty level or not. - */ - void CheckDifficultyLevel() - { - if (_game_mode == GM_MENU) { - if (_settings_newgame.difficulty.diff_level != SP_CUSTOM) { - _settings_newgame.difficulty.diff_level = SP_CUSTOM; - ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, WL_WARNING); - } - } else if (_settings_game.difficulty.diff_level != SP_CUSTOM) { - IConsoleSetSetting("difficulty.diff_level", SP_CUSTOM); - } - } - virtual void OnPaint() { if (this->closing_dropdown) { @@ -517,8 +502,6 @@ this->ai_config->SetSetting(config_item.name, new_val); this->clicked_button = num; this->timeout = 5; - - this->CheckDifficultyLevel(); } } else if (!bool_item && !config_item.complete_labels) { /* Display a query box so users can enter a custom value. */ @@ -550,7 +533,6 @@ if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return; int32 value = atoi(str); this->ai_config->SetSetting((*it).name, value); - this->CheckDifficultyLevel(); this->SetDirty(); } @@ -561,7 +543,6 @@ for (int i = 0; i < this->clicked_row; i++) it++; if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return; this->ai_config->SetSetting((*it).name, index); - this->CheckDifficultyLevel(); this->SetDirty(); }
--- a/src/script/script_config.cpp +++ b/src/script/script_config.cpp @@ -86,11 +86,6 @@ int ScriptConfig::GetSetting(const char *name) const { - /* Return default values if the difficulty is not set to Custom */ - if (GetGameSettings().difficulty.diff_level != SP_CUSTOM) { - return this->info->GetSettingDefaultValue(name); - } - SettingValueList::const_iterator it = this->settings.find(name); if (it == this->settings.end()) return this->info->GetSettingDefaultValue(name); return (*it).second;