changeset 17622:ddbc50deb5b7 draft

(svn r22386) -Fix [FS#4602]: When the last AI company gets removed, the 'dead' state was not reset in the AI debug window.
author frosch <frosch@openttd.org>
date Sat, 30 Apr 2011 17:08:18 +0000
parents 6bf2acbcbea5
children 6d1b81b7ed6e
files src/ai/ai_gui.cpp
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -816,9 +816,8 @@
 		/* 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 @@
 
 		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 @@
 			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();