| 974 | bool Agent::isDead() const { return getHealth() <= 0; } |
| 975 | |
| 976 | void Agent::handleDeath(GameState &state) |
| 977 | { |
| 978 | if (isDead() && status == AgentStatus::Alive) |
| 979 | { |
| 980 | status = AgentStatus::Dead; |
| 981 | |
| 982 | const auto thisRef = StateRef<Agent>{&state, shared_from_this()}; |
| 983 | |
| 984 | // Remove from building |
| 985 | if (currentBuilding && !state.current_battle) |
| 986 | { |
| 987 | currentBuilding->currentAgents.erase(thisRef); |
| 988 | } |
| 989 | |
| 990 | // In city we remove agent |
| 991 | if (!state.current_battle) |
| 992 | { |
| 993 | state.agentsDeathNote.insert(getId(state, shared_from_this())); |
| 994 | } |
| 995 | } |
| 996 | } |
| 997 | |
| 998 | void Agent::update(GameState &state, unsigned ticks) |
| 999 | { |
no test coverage detected