Old revision #pkbvssddy | New 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 | */ | ||
7 | static bool IsDead(CompanyID slot) | 2 | static 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 */ | ||
13 | static 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 */ | ||
23 | static 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 | } |