summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-04-30 17:08:18 +0000
committerfrosch <frosch@openttd.org>2011-04-30 17:08:18 +0000
commitbdc8a59ff4f3da26d2f96d29ec123d2f16f30fe1 (patch)
treeaa8d6a87531f04dd561579dd1cc7e1a210b96367 /src/ai
parent46c242b1dc790e7e55b739dcf5e4133c4ab2e8b2 (diff)
downloadopenttd-bdc8a59ff4f3da26d2f96d29ec123d2f16f30fe1.tar.xz
(svn r22386) -Fix [FS#4602]: When the last AI company gets removed, the 'dead' state was not reset in the AI debug window.
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai_gui.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 7d2b1fecd..1f57b8ebc 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -816,9 +816,8 @@ struct AIDebugWindow : public QueryStringBaseWindow {
/* Check if the currently selected company is still active. */
if (ai_debug_company == INVALID_COMPANY || !Company::IsValidAiID(ai_debug_company)) {
if (ai_debug_company != INVALID_COMPANY) {
- /* Raise and disable the widget for the previous selection. */
+ /* Raise the widget for the previous selection. */
this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
- this->DisableWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
ai_debug_company = INVALID_COMPANY;
}
@@ -848,9 +847,6 @@ struct AIDebugWindow : public QueryStringBaseWindow {
if (this->show_break_box) this->DrawEditBox(AID_WIDGET_BREAK_STR_EDIT_BOX);
- /* If there are no active companies, don't display anything else. */
- if (ai_debug_company == INVALID_COMPANY) return;
-
/* Paint the company icons */
for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
NWidgetCore *button = this->GetWidget<NWidgetCore>(i + AID_WIDGET_COMPANY_BUTTON_START);
@@ -881,6 +877,9 @@ struct AIDebugWindow : public QueryStringBaseWindow {
DrawCompanyIcon(i, button->pos_x + button->current_x / 2 - 7 + offset, this->GetWidget<NWidgetBase>(AID_WIDGET_COMPANY_BUTTON_START + i)->pos_y + 2 + offset);
}
+ /* If there are no active companies, don't display anything else. */
+ if (ai_debug_company == INVALID_COMPANY) return;
+
Backup<CompanyByte> cur_company(_current_company, ai_debug_company, FILE_LINE);
AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer();
cur_company.Restore();