| 2066 | } |
| 2067 | |
| 2068 | bool 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 | |
| 2096 | void Battle::refreshLeadershipBonus(StateRef<Organisation> org) |
| 2097 | { |