Loading

Revision differences

Old revision #pna6tfy4sNew revision #pcutdxwf1
1/* old code */  1/**
   2* Check whether a script, be it AI or GS, is dead in this slot.
   3* @note Also returns dead for AI slots which are currently occupied
   4*       by Human Companies or when the AI didn't start.
   5* @note Also returns dead when no GS was set up.
   6* @param slot The slot that is checked.
   7* @return true if the slot that is checked is dead.
   8*/
2static bool IsDead(CompanyID slot)  9static bool IsDead(CompanyID slot)  
3{  10{  
4    if (slot == OWNER_DEITY) {  11    if (slot == OWNER_DEITY) {  
  
6    } else {  13    } else {  
7        return !Company::IsValidAiID(slot) || Company::Get(slot)->ai_instance->IsDead();  14        return !Company::IsValidAiID(slot) || Company::Get(slot)->ai_instance->IsDead();  
8    }  15    }  
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    }    
31} 16}