Loading

Paste #pnchdlx6n

  1. bool editable = _game_mode != GM_NORMAL || (_game_mode == GM_NORMAL && this->slot == OWNER_DEITY && Game::GetInstance()->IsDead()) || (_game_mode == GM_NORMAL && this->slot == OWNER_DEITY && !Game::GetInstance()->IsDead() && (config_item.flags & SCRIPTCONFIG_INGAME) != 0) || (_game_mode == GM_NORMAL && this->slot != OWNER_DEITY && !Company::IsValidID(this->slot)) || (_game_mode == GM_NORMAL && this->slot != OWNER_DEITY && Company::IsValidAiID(this->slot) && Company::Get(this->slot)->ai_instance->IsDead()) || (_game_mode == GM_NORMAL && this->slot != OWNER_DEITY && Company::IsValidAiID(this->slot) && !Company::Get(this->slot)->ai_instance->IsDead() && (config_item.flags & SCRIPTCONFIG_INGAME) != 0);
  2.  
  3. /* dissected line */
  4. bool editable =
  5. _game_mode != GM_NORMAL ||
  6. (_game_mode == GM_NORMAL && this->slot == OWNER_DEITY && Game::GetInstance()->IsDead()) ||
  7. (_game_mode == GM_NORMAL && this->slot == OWNER_DEITY && !Game::GetInstance()->IsDead() && (config_item.flags & SCRIPTCONFIG_INGAME) != 0) ||
  8. (_game_mode == GM_NORMAL && this->slot != OWNER_DEITY && !Company::IsValidID(this->slot)) ||
  9. (_game_mode == GM_NORMAL && this->slot != OWNER_DEITY && Company::IsValidAiID(this->slot) && Company::Get(this->slot)->ai_instance->IsDead()) ||
  10. (_game_mode == GM_NORMAL && this->slot != OWNER_DEITY && Company::IsValidAiID(this->slot) && !Company::Get(this->slot)->ai_instance->IsDead() && (config_item.flags & SCRIPTCONFIG_INGAME) != 0);
  11.  
  12.  
  13. /* Find out which parameters are editable */
  14. _game_mode != GM_NORMAL // not in a game, and thus, editable
  15. _game_mode == GM_NORMAL // in a game, orange, red and green have parameters, check if they're AI or GS
  16.  
  17. this->slot != OWNER_DEITY // it's an AI slot, check if it's orange, red or green
  18. this->slot == OWNER_DEITY // it's a GS slot, check IsDead
  19.  
  20. /* GS Check */
  21. Game::GetInstance()->IsDead() = true  // GS is red and dead, and thus, editable
  22. Game::GetInstance()->IsDead() = false // GS is green and not dead, check flag
  23.  
  24. /* AI Check */
  25. Company::IsValidAiID(this->slot) = true  // AI started this company, check if it's red or green
  26. Company::IsValidAiID(this->slot) = false // No AI started this company, or a human started it, this slot is orange or silver, but assume it as being orange, and thus, editable
  27.  
  28. Company::Get(this->slot)->ai_instance->IsDead() = true  // AI is red and dead, and thus, editable
  29. Company::Get(this->slot)->ai_instance->IsDead() = false // AI is green and not dead, check flag
  30.  
  31. /* Flag Check */
  32. (config_item.flags & SCRIPTCONFIG_INGAME) != 0 // flag is set, and thus, editable
  33. (config_item.flags & SCRIPTCONFIG_INGAME) == 0 // flag is not set, and thus, not editable

Version history

Revision # Author Created at
pudxpqhgr Anonymous 25 Apr 2016, 19:17:17 UTC Diff
p7c0lr2u8 Anonymous 25 Apr 2016, 16:16:15 UTC Diff

Comments