mirror of https://github.com/OpenTTD/OpenTTD
pull/7124/head
parent
80c7965c65
commit
654b635f6f
|
@ -378,7 +378,7 @@ struct AISettingsWindow : public Window {
|
||||||
for (; this->vscroll->IsVisible(i) && it != visible_settings.end(); i++, it++) {
|
for (; this->vscroll->IsVisible(i) && it != visible_settings.end(); i++, it++) {
|
||||||
const ScriptConfigItem &config_item = **it;
|
const ScriptConfigItem &config_item = **it;
|
||||||
int current_value = config->GetSetting((config_item).name);
|
int current_value = config->GetSetting((config_item).name);
|
||||||
bool editable = _game_mode == GM_MENU || ((this->slot != OWNER_DEITY) && !Company::IsValidID(this->slot)) || (config_item.flags & SCRIPTCONFIG_INGAME) != 0;
|
bool editable = this->IsEditableItem(config_item);
|
||||||
|
|
||||||
StringID str;
|
StringID str;
|
||||||
TextColour colour;
|
TextColour colour;
|
||||||
|
@ -441,7 +441,7 @@ struct AISettingsWindow : public Window {
|
||||||
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
|
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
|
||||||
for (int i = 0; i < num; i++) it++;
|
for (int i = 0; i < num; i++) it++;
|
||||||
const ScriptConfigItem config_item = **it;
|
const ScriptConfigItem config_item = **it;
|
||||||
if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
|
if (!this->IsEditableItem(config_item)) return;
|
||||||
|
|
||||||
if (this->clicked_row != num) {
|
if (this->clicked_row != num) {
|
||||||
DeleteChildWindows(WC_QUERY_STRING);
|
DeleteChildWindows(WC_QUERY_STRING);
|
||||||
|
@ -586,6 +586,12 @@ struct AISettingsWindow : public Window {
|
||||||
{
|
{
|
||||||
this->RebuildVisibleSettings();
|
this->RebuildVisibleSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool IsEditableItem(const ScriptConfigItem config_item) const
|
||||||
|
{
|
||||||
|
return _game_mode == GM_MENU || ((this->slot != OWNER_DEITY) && !Company::IsValidID(this->slot)) || (config_item.flags & SCRIPTCONFIG_INGAME) != 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Widgets for the AI settings window. */
|
/** Widgets for the AI settings window. */
|
||||||
|
|
Loading…
Reference in New Issue