Loading

Revision differences

Old revision #pkbvssddyNew revision #pna6tfy4s
1/**  1/* old code */
2* Check whether a Game Script is not running, or if it is running, if it is dead.    
3* Check whether an AI slot is not started, or if it is started, it is not an AI, or if it is an AI, if it is dead.    
4* @param slot The slot that is checked.    
5* @return true if the slot that is checked is dead.    
6*/    
7static bool IsDead(CompanyID slot)  2static bool IsDead(CompanyID slot)  
8{  3{  
9    if (slot == OWNER_DEITY) {  4    if (slot == OWNER_DEITY) {  
  
11    } else {  6    } else {  
12        return !Company::IsValidAiID(slot) || Company::Get(slot)->ai_instance->IsDead();  7        return !Company::IsValidAiID(slot) || Company::Get(slot)->ai_instance->IsDead();  
13    }  8    }  
  9}  
  10  
  11  
  12/* new code function 1 */  
  13static bool IsStarted(CompanyID slot)  
  14{  
  15    if (slot == OWNER_DEITY) {  
  16        return !Game::GetInstance() == NULL;  
  17    } else {  
  18        return Company::IsValidAiID(slot);  
  19    }  
  20}  
  21  
  22/* new code function 2 */  
  23static bool IsDead(CompanyID slot)  
  24{  
  25    assert (IsStarted(slot));  
  26    if (slot == OWNER_DEITY) {  
  27        return Game::GetInstance()->IsDead();  
  28    } else {  
  29        return Company::Get(slot)->ai_instance->IsDead();  
  30    }  
14} 31}