MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / tryDisableBuilding

Method tryDisableBuilding

game/state/battle/battle.cpp:2068–2094  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2066}
2067
2068bool Battle::tryDisableBuilding()
2069{
2070 // Find a mission objective unit
2071 for (auto &u : units)
2072 {
2073 if (u.second->owner != locationOwner)
2074 {
2075 continue;
2076 }
2077 if (u.second->agent->type->missionObjective && !u.second->isDead())
2078 {
2079 // Mission objective unit found alive
2080 return false;
2081 }
2082 }
2083 // Find a mission objective object
2084 for (auto &mp : map_parts)
2085 {
2086 if (mp->type->missionObjective && !mp->destroyed)
2087 {
2088 // Mission objective unit found alive
2089 return false;
2090 }
2091 }
2092 // Found nothing, building disabled
2093 return true;
2094}
2095
2096void Battle::refreshLeadershipBonus(StateRef<Organisation> org)
2097{

Callers 1

beginBattleMethod · 0.80

Calls 1

isDeadMethod · 0.45

Tested by

no test coverage detected