Loading

Paste #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.  
  13. Check first slot:                                                           Check second slot:
  14. is_gs_slot  = false // GS slot isn't selected                               silver:
  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
  16.  
  17. invalid_slot= false // nothing isn't selected                               orange:
  18. invalid_slot= true  // nothing is selected, and thus, unmovable             IsEditable  = true  // slot could be orange, red or green
  19.                                                                             IsValidID   = false // slot is orange, and thus, first and second slots are movable
  20. orange:
  21. IsEditable  = true  // slot could be orange, red or green                   green:
  22. IsValidID   = false // slot is orange, and thus, check second slot          IsEditable  = true  // slot could be orange, red or green
  23.                                                                             IsValidID   = true  // slot could be red or green
  24. green:                                                                      IsValidAiID = true  // slot could be red or green
  25. IsEditable  = true  // slot could be orange, red or green                   IsDead      = false // slot is green, and thus, unmovable
  26. IsValidID   = true  // slot could be red or green
  27. IsValidAiID = true  // slot could be red or green                           red:
  28. IsDead      = false // slot is green, and thus, unmovable                   IsEditable  = true  // slot could be orange, red or green
  29.                                                                             IsValidID   = true  // slot could be red or green
  30. red:                                                                        IsValidAiID = true  // slot could be red or green
  31. IsEditable  = true  // slot could be orange, red or green                   IsDead      = true  // slot is red, and thus, first and second slots are movable
  32. IsValidID   = true  // slot could be red or green
  33. IsValidAiID = true  // slot could be red or green
  34. IsDead      = true  // slot is red, and thus, check second slot

Version history

Revision # Author Created at
pqfngbwiy Anonymous 11 Apr 2016, 13:13:52 UTC Diff
pwldz1rs3 Anonymous 11 Apr 2016, 13:11:49 UTC Diff
pi7dgzowb Anonymous 11 Apr 2016, 12:19:50 UTC Diff

Comments