1
0
Fork 0

(svn r22499) -Fix: don't lower the arrow buttons in the newgrf/AI parameter windows if they're clicked when disabled

release/1.2
yexo 2011-05-27 18:02:55 +00:00
parent 56902191e4
commit ffdfa5a213
2 changed files with 16 additions and 11 deletions

View File

@ -390,6 +390,7 @@ struct AISettingsWindow : public Window {
/* One of the arrows is clicked (or green/red rect in case of bool value) */ /* One of the arrows is clicked (or green/red rect in case of bool value) */
if (IsInsideMM(x, 0, 21)) { if (IsInsideMM(x, 0, 21)) {
int new_val = this->ai_config->GetSetting(config_item.name); int new_val = this->ai_config->GetSetting(config_item.name);
int old_val = new_val;
if (bool_item) { if (bool_item) {
new_val = !new_val; new_val = !new_val;
} else if (x >= 10) { } else if (x >= 10) {
@ -404,19 +405,21 @@ struct AISettingsWindow : public Window {
this->clicked_increase = false; this->clicked_increase = false;
} }
if (new_val != old_val) {
this->ai_config->SetSetting(config_item.name, new_val); this->ai_config->SetSetting(config_item.name, new_val);
this->clicked_button = num; this->clicked_button = num;
this->timeout = 5; this->timeout = 5;
this->CheckDifficultyLevel(); this->CheckDifficultyLevel();
this->SetDirty();
}
} else if (!bool_item) { } else if (!bool_item) {
/* Display a query box so users can enter a custom value. */ /* Display a query box so users can enter a custom value. */
this->clicked_row = num; this->clicked_row = num;
SetDParam(0, this->ai_config->GetSetting(config_item.name)); SetDParam(0, this->ai_config->GetSetting(config_item.name));
ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_NONE); ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_NONE);
} }
this->SetDirty();
break; break;
} }

View File

@ -325,6 +325,7 @@ struct NewGRFParametersWindow : public Window {
/* One of the arrows is clicked */ /* One of the arrows is clicked */
if (IsInsideMM(x, 0, 21)) { if (IsInsideMM(x, 0, 21)) {
uint32 val = par_info->GetValue(this->grf_config); uint32 val = par_info->GetValue(this->grf_config);
uint32 old_val = val;
if (par_info->type == PTYPE_BOOL) { if (par_info->type == PTYPE_BOOL) {
val = !val; val = !val;
} else { } else {
@ -338,17 +339,18 @@ struct NewGRFParametersWindow : public Window {
this->clicked_increase = false; this->clicked_increase = false;
} }
} }
if (val != old_val) {
par_info->SetValue(this->grf_config, val); par_info->SetValue(this->grf_config, val);
this->clicked_button = num; this->clicked_button = num;
this->timeout = 5; this->timeout = 5;
this->SetDirty();
}
} else if (par_info->type == PTYPE_UINT_ENUM && click_count >= 2) { } else if (par_info->type == PTYPE_UINT_ENUM && click_count >= 2) {
/* Display a query box so users can enter a custom value. */ /* Display a query box so users can enter a custom value. */
SetDParam(0, this->grf_config->param[num]); SetDParam(0, this->grf_config->param[num]);
ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_NONE); ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_NONE);
} }
this->SetDirty();
break; break;
} }