summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai_gui.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 4b248f5ef..8dad16fab 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -378,7 +378,7 @@ struct AISettingsWindow : public Window {
for (; this->vscroll->IsVisible(i) && it != visible_settings.end(); i++, it++) {
const ScriptConfigItem &config_item = **it;
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;
TextColour colour;
@@ -441,7 +441,7 @@ struct AISettingsWindow : public Window {
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
for (int i = 0; i < num; i++) 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) {
DeleteChildWindows(WC_QUERY_STRING);
@@ -586,6 +586,12 @@ struct AISettingsWindow : public Window {
{
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. */