Loading

Revision differences

Old revision #powsd7efuNew revision #praxk2bpp
8  8  
9        this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);  9        this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);  
10        this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES);  10        this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES);  
11         11
12        bool is_gs_slot = this->selected_slot == OWNER_DEITY;  12        bool is_gs_slot = this->selected_slot == OWNER_DEITY;  
13        bool invalid_slot = this->selected_slot == INVALID_COMPANY;  13        bool invalid_slot = this->selected_slot == INVALID_COMPANY;  
14        bool is_green_slot = Company::IsValidAiID(this->selected_slot) && !Company::Get(this->selected_slot)->ai_instance->IsDead();  14        bool is_green_slot = Company::IsValidAiID(this->selected_slot) && !Company::Get(this->selected_slot)->ai_instance->IsDead();  
15        this->SetWidgetDisabledState(WID_AIC_CHANGE, invalid_slot || (_game_mode == GM_NORMAL && (is_gs_slot || (IsEditable(this->selected_slot) && is_green_slot))));  15        this->SetWidgetDisabledState(WID_AIC_CHANGE, invalid_slot || _game_mode == GM_NORMAL && (is_gs_slot || is_green_slot));
16        this->SetWidgetDisabledState(WID_AIC_CONFIGURE, invalid_slot || GetConfig(this->selected_slot)->GetConfigList()->size() == 0);  16        this->SetWidgetDisabledState(WID_AIC_CONFIGURE, invalid_slot || GetConfig(this->selected_slot)->GetConfigList()->size() == 0);  
17  17  
18        /* Display either Settings or Configure button */  18        /* Display either Settings or Configure button */  
19        NWidgetCore *configure_button = this->GetWidget<NWidgetCore>(WID_AIC_CONFIGURE);  19        NWidgetCore *configure_button = this->GetWidget<NWidgetCore>(WID_AIC_CONFIGURE);  
20        if (_game_mode == GM_NORMAL && !invalid_slot && IsEditable(this->selected_slot) && (is_gs_slot || is_green_slot)) {  20        if (_game_mode == GM_NORMAL && !invalid_slot && (is_gs_slot || is_green_slot)) {
21            configure_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);  21            configure_button->SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP);  
22        } else {  22        } else {  
23            configure_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);  23            configure_button->SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP);  
24        }  24        }  
25  25  
26        bool is_silver_slot_above = !IsEditable((CompanyID)(this->selected_slot - 1));  26        bool is_silver_slot_above = !IsEditable((CompanyID)(this->selected_slot - 1));  
27        bool is_green_slot_above = IsEditable((CompanyID)(this->selected_slot - 1)) && Company::IsValidAiID(this->selected_slot - 1) && !Company::Get(this->selected_slot - 1)->ai_instance->IsDead();  27        bool is_green_slot_above = Company::IsValidAiID(this->selected_slot - 1) && !Company::Get(this->selected_slot - 1)->ai_instance->IsDead();
28        this->SetWidgetDisabledState(WID_AIC_MOVE_UP, is_gs_slot || invalid_slot || (IsEditable(this->selected_slot) && is_green_slot) || is_silver_slot_above || is_green_slot_above);  28        this->SetWidgetDisabledState(WID_AIC_MOVE_UP, is_gs_slot || invalid_slot || is_green_slot || is_silver_slot_above || is_green_slot_above);
29         29
30        bool is_silver_slot_below = !IsEditable((CompanyID)(this->selected_slot + 1));  30        bool is_silver_slot_below = !IsEditable((CompanyID)(this->selected_slot + 1));  
31        bool is_green_slot_below = IsEditable((CompanyID)(this->selected_slot + 1)) && Company::IsValidAiID(this->selected_slot + 1) && !Company::Get(this->selected_slot + 1)->ai_instance->IsDead();  31        bool is_green_slot_below = Company::IsValidAiID(this->selected_slot + 1) && !Company::Get(this->selected_slot + 1)->ai_instance->IsDead();
32        this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, is_gs_slot || invalid_slot || (IsEditable(this->selected_slot) && is_green_slot) || is_silver_slot_below || is_green_slot_below);  32        this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, is_gs_slot || invalid_slot || is_green_slot || is_silver_slot_below || is_green_slot_below);
33  33  
34        for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {  34        for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {  
35            this->SetWidgetDisabledState(WID_AIC_TEXTFILE + tft, invalid_slot || (GetConfig(this->selected_slot)->GetTextfile(tft, this->selected_slot) == NULL));  35            this->SetWidgetDisabledState(WID_AIC_TEXTFILE + tft, invalid_slot || (GetConfig(this->selected_slot)->GetTextfile(tft, this->selected_slot) == NULL));