- bool is_gs_slot = this->selected_slot == OWNER_DEITY;
- bool invalid_slot = this->selected_slot == INVALID_COMPANY;
- 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();
- bool is_silver_slot_above = !IsEditable((CompanyID)(this->selected_slot - 1));
- bool is_silver_slot_below = !IsEditable((CompanyID)(this->selected_slot + 1));
- 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();
- 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();
- this->SetWidgetDisabledState(WID_AIC_MOVE_UP, is_gs_slot || invalid_slot || is_green_slot || is_silver_slot_above || is_green_slot_above);
- this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, is_gs_slot || invalid_slot || is_green_slot || is_silver_slot_below || is_green_slot_below);
- Check first slot: Check second slot:
- is_gs_slot = false // GS slot isn't selected silver:
- 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
- invalid_slot= false // nothing isn't selected orange:
- invalid_slot= true // nothing is selected, and thus, unmovable IsEditable = true // slot could be orange, red or green
- IsValidID = false // slot is orange, and thus, first and second slots are movable
- orange:
- IsEditable = true // slot could be orange, red or green green:
- IsValidID = false // slot is orange, and thus, check second slot IsEditable = true // slot could be orange, red or green
- IsValidID = true // slot could be red or green
- green: IsValidAiID = true // slot could be red or green
- IsEditable = true // slot could be orange, red or green IsDead = false // slot is green, and thus, unmovable
- IsValidID = true // slot could be red or green
- IsValidAiID = true // slot could be red or green red:
- IsDead = false // slot is green, and thus, unmovable IsEditable = true // slot could be orange, red or green
- IsValidID = true // slot could be red or green
- red: IsValidAiID = true // slot could be red or green
- IsEditable = true // slot could be orange, red or green IsDead = true // slot is red, and thus, first and second slots are movable
- IsValidID = true // slot could be red or green
- IsValidAiID = true // slot could be red or green
- IsDead = true // slot is red, and thus, check second slot