Index: src/ai/ai_gui.cpp
===================================================================
--- src/ai/ai_gui.cpp (revision 27549)
+++ src/ai/ai_gui.cpp (working copy)
@@ -685,7 +685,7 @@
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),
NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CHANGE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP),
- NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_DEBUG_SETTINGS_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CLOSE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7),
@@ -751,6 +751,29 @@
break;
}
break;
+// case WID_AIC_CONFIGURE:
+// switch (selected_slot) {
+// case OWNER_DEITY:
+// if (_game_mode == GM_NORMAL && IsEditable(selected_slot)) {
+// SetDParam(0, STR_AI_DEBUG_SETTINGS);
+// } else {
+// SetDParam(0, STR_AI_CONFIG_CONFIGURE);
+// }
+// break;
+
+// case INVALID_COMPANY:
+// SetDParam(0, STR_AI_CONFIG_CONFIGURE);
+// break;
+
+// default:
+// if (_game_mode != GM_NORMAL || (_game_mode == GM_NORMAL && IsEditable((CompanyID)selected_slot) && (!Company::IsValidID(selected_slot) || Company::IsValidAiID(selected_slot) && Company::Get(selected_slot)->ai_instance->IsDead()))) {
+// SetDParam(0, STR_AI_CONFIG_CONFIGURE);
+// } else {
+// SetDParam(0, STR_AI_DEBUG_SETTINGS);
+// }
+// break;
+// }
+// break;
}
}
@@ -925,6 +948,16 @@
this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
this->SetWidgetDisabledState(WID_AIC_CHANGE, (this->selected_slot == OWNER_DEITY && _game_mode == GM_NORMAL) || this->selected_slot == INVALID_COMPANY);
this->SetWidgetDisabledState(WID_AIC_CONFIGURE, this->selected_slot == INVALID_COMPANY || GetConfig(this->selected_slot)->GetConfigList()->size() == 0);
+
+ NWidgetCore *configure_button = this->GetWidget<NWidgetCore>(WID_AIC_CONFIGURE);
+ /* Display Configure button*/
+ if (this->selected_slot == INVALID_OWNER || (this->selected_slot == OWNER_DEITY && _game_mode != GM_NORMAL && IsEditable(this->selected_slot)) || ((this->selected_slot != OWNER_DEITY && this->selected_slot != INVALID_OWNER) && (_game_mode != GM_NORMAL || (_game_mode == GM_NORMAL && IsEditable((CompanyID)selected_slot) && (!Company::IsValidID(selected_slot) || Company::IsValidAiID(selected_slot) && Company::Get(selected_slot)->ai_instance->IsDead()))))) {
+ configure_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);
+ } else {
+ /* Display Settings button */
+ configure_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);
+ }
+
this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));