3 | bool is_green_ai_slot = Company::IsValidAiID(selected_slot) && !Company::Get(selected_slot)->ai_instance->IsDead();
| 10 | bool invalid_slot = this->selected_slot == INVALID_COMPANY;
|
---|
| | 11 | bool is_green_slot = IsEditable((CompanyID)(this->selected_slot)) && Company::IsValidID(this->selected_slot) && Company::IsValidAiID(this->selected_slot) && !Company::Get(this->selected_slot)->ai_instance->IsDead();
|
---|
| | 12 | bool is_silver_slot_above = !IsEditable((CompanyID)(this->selected_slot - 1));
|
---|
| | 13 | bool is_silver_slot_below = !IsEditable((CompanyID)(this->selected_slot + 1));
|
---|
| | 14 | bool is_green_slot_above = IsEditable((CompanyID)(this->selected_slot - 1)) && Company::IsValidID(this->selected_slot - 1) && Company::IsValidAiID(this->selected_slot - 1) && !Company::Get(this->selected_slot - 1)->ai_instance->IsDead();
|
---|
| | 15 | bool is_green_slot_below = IsEditable((CompanyID)(this->selected_slot + 1)) && Company::IsValidID(this->selected_slot + 1) && Company::IsValidAiID(this->selected_slot + 1) && !Company::Get(this->selected_slot + 1)->ai_instance->IsDead();
|
---|
| | 16 |
|
---|
| | 17 | this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
|
---|
| | 18 | this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES);
|
---|
| | 19 | this->SetWidgetDisabledState(WID_AIC_CHANGE, _game_mode == GM_NORMAL && (is_gs_slot || is_green_slot) || invalid_slot);
|
---|
| | 20 | this->SetWidgetDisabledState(WID_AIC_CONFIGURE, invalid_slot || GetConfig(this->selected_slot)->GetConfigList()->size() == 0);
|
---|
| | 21 |
|
---|
| | 22 | /* Display either Settings or Configure button */
|
---|
| | 23 | NWidgetCore *configure_button = this->GetWidget<NWidgetCore>(WID_AIC_CONFIGURE);
|
---|
| | 24 | bool selected_ingame = _game_mode == GM_NORMAL && !invalid_slot && IsEditable(this->selected_slot);
|
---|
| | 25 | bool is_green_ai_slot = Company::IsValidAiID(this->selected_slot) && !Company::Get(this->selected_slot)->ai_instance->IsDead();
|
---|
4 | if (selected_ingame && (is_gs_slot || is_green_ai_slot)) {
| 26 | if (selected_ingame && (is_gs_slot || is_green_ai_slot)) {
|
---|
5 | configure_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);
| 27 | configure_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);
|
---|
6 | } else {
| 28 | } else {
|
---|
7 | configure_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);
| 29 | configure_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);
|
---|