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

Method handleDeath

game/state/shared/agent.cpp:976–996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

974bool Agent::isDead() const { return getHealth() <= 0; }
975
976void 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
998void Agent::update(GameState &state, unsigned ticks)
999{

Callers 2

updateHirableAgentsMethod · 0.80
executeOrdersMethod · 0.80

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected