summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-12-05 19:35:38 +0000
committerfrosch <frosch@openttd.org>2012-12-05 19:35:38 +0000
commite43bf5dabdb4a62b4e6b6812db422b962b4eaaf1 (patch)
tree6701005ef52a18c62ca5f79f3d34d130cc92418d /src
parent22dc45738d2a3a9634693e43dbbf95d948142b83 (diff)
downloadopenttd-e43bf5dabdb4a62b4e6b6812db422b962b4eaaf1.tar.xz
(svn r24788) -Change: Detach script settings from difficulty settings. Always allow changing all script settings without setting difficulty to custom.
Diffstat (limited to 'src')
-rw-r--r--src/ai/ai_config.cpp2
-rw-r--r--src/ai/ai_gui.cpp19
-rw-r--r--src/script/script_config.cpp5
3 files changed, 1 insertions, 25 deletions
diff --git a/src/ai/ai_config.cpp b/src/ai/ai_config.cpp
index 295495457..7241eab0a 100644
--- a/src/ai/ai_config.cpp
+++ b/src/ai/ai_config.cpp
@@ -80,7 +80,7 @@ int AIConfig::GetSetting(const char *name) const
{
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;
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index f287442fc..acb95a4a3 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -416,21 +416,6 @@ struct AISettingsWindow : public Window {
}
}
- /**
- * 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 @@ struct AISettingsWindow : public Window {
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 @@ struct AISettingsWindow : public Window {
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 @@ struct AISettingsWindow : public Window {
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();
}
diff --git a/src/script/script_config.cpp b/src/script/script_config.cpp
index 46f13cd0c..7260febdf 100644
--- a/src/script/script_config.cpp
+++ b/src/script/script_config.cpp
@@ -86,11 +86,6 @@ void ScriptConfig::ClearConfigList()
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;