@@ -1189,38 +1189,37 @@ struct PerformanceRatingDetailWindow : W
this->SetDirty();
}
/**
* Invalidate the data of this window.
* @param data the company ID of the company that is going to be removed
*/
virtual void OnInvalidateData(int data)
{
/* Disable the companies who are not active */
for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
this->SetWidgetDisabledState(i + PRW_COMPANY_FIRST, !Company::IsValidID(i) || i == data);
this->SetWidgetDisabledState(i + PRW_COMPANY_FIRST, !Company::IsValidID(i));
/* Check if the currently selected company is still active. */
if (this->company == data || (this->company != INVALID_COMPANY && !Company::IsValidID(this->company))) {
if (this->company != INVALID_COMPANY && !Company::IsValidID(this->company)) {
/* Raise the widget for the previous selection. */
this->RaiseWidget(this->company + PRW_COMPANY_FIRST);
this->company = INVALID_COMPANY;
if (this->company == INVALID_COMPANY) {
const Company *c;
FOR_ALL_COMPANIES(c) {
if (c->index == data) continue; // Ignore to-be-removed company
this->company = c->index;
break;
/* Make sure the widget is lowered */
this->LowerWidget(this->company + PRW_COMPANY_FIRST);
};
CompanyID PerformanceRatingDetailWindow::company = INVALID_COMPANY;