/* Check that the expenses panel height matches the height needed for the layout. */
int type = _settings_client.gui.expenses_layout;
if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetBase>(CFW_EXPS_CATEGORY)->current_y) {
if (!this->IsShaded()) {
if (!small) {
/* Check that the expenses panel height matches the height needed for the layout. */
int type = _settings_client.gui.expenses_layout;
if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetBase>(CFW_EXPS_CATEGORY)->current_y) {
this->SetupWidgets();
this->ReInit();
return;
}
}
/* Check that the loan buttons are shown only when the user owns the company. */
CompanyID company = (CompanyID)this->window_number;
int req_plane = (company != _local_company) ? STACKED_SELECTION_ZERO_SIZE : 0;
if (req_plane != this->GetWidget<NWidgetStacked>(CFW_SEL_BUTTONS)->shown_plane) {
this->SetupWidgets();
this->ReInit();
return;
}
const Company *c = Company::Get(company);
this->SetWidgetDisabledState(CFW_INCREASE_LOAN, c->current_loan == _economy.max_loan); // Borrow button only shows when there is any more money to loan.
this->SetWidgetDisabledState(CFW_REPAY_LOAN, company != _local_company || c->current_loan == 0); // Repay button only shows when there is any more money to repay.
}
/* Check that the loan buttons are shown only when the user owns the company. */
CompanyID company = (CompanyID)this->window_number;
int req_plane = (company != _local_company) ? STACKED_SELECTION_ZERO_SIZE : 0;
if (req_plane != this->GetWidget<NWidgetStacked>(CFW_SEL_BUTTONS)->shown_plane) {
this->SetupWidgets();
this->ReInit();
return;
}
const Company *c = Company::Get(company);
this->SetWidgetDisabledState(CFW_INCREASE_LOAN, c->current_loan == _economy.max_loan); // Borrow button only shows when there is any more money to loan.
this->SetWidgetDisabledState(CFW_REPAY_LOAN, company != _local_company || c->current_loan == 0); // Repay button only shows when there is any more money to repay.