Old revision #pi7dgzowb | New revision #pmsvkvyjl | ||
---|---|---|---|
1 | bool is_gs_slot = this->selected_slot == OWNER_DEITY; | ||
2 | bool invalid_slot = this->selected_slot == INVALID_COMPANY; | ||
3 | 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(); | ||
4 | bool is_silver_slot_above = !IsEditable((CompanyID)(this->selected_slot - 1)); | ||
5 | bool is_silver_slot_below = !IsEditable((CompanyID)(this->selected_slot + 1)); | ||
6 | 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(); | ||
7 | 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(); | ||
8 | |||
9 | this->SetWidgetDisabledState(WID_AIC_MOVE_UP, is_gs_slot || invalid_slot || is_green_slot || is_silver_slot_above || is_green_slot_above); | ||
10 | this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, is_gs_slot || invalid_slot || is_green_slot || is_silver_slot_below || is_green_slot_below); | ||
11 | |||
12 | |||
1 | Check first slot: Check second slot: | 13 | Check first slot: Check second slot: |
2 | is_gs_slot = false // GS slot isn't selected silver: | 14 | is_gs_slot = false // GS slot isn't selected silver: |
3 | is_gs_slot = true // GS slot is selected, and thus, unmovable IsEditable = false // human player in this slot, or outside slot range of 1-15, and thus, unmovable | 15 | is_gs_slot = true // GS slot is selected, and thus, unmovable IsEditable = false // human player in this slot, or outside slot range of 1-15, and thus, unmovable |