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

Method die

game/state/battle/battleexplosion.cpp:35–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void BattleExplosion::die(GameState &state)
36{
37 auto this_shared = shared_from_this();
38 state.current_battle->explosions.erase(this_shared);
39 // Deal damage
40 if (damageInTheEnd)
41 {
42 auto &map = *state.current_battle->map;
43 for (auto &pos : locationsToDamage)
44 {
45 damage(state, map, pos.first, pos.second);
46 }
47 }
48 // Hack to make all hazards update at once
49 auto &map = *state.current_battle->map;
50 for (auto &pos : locationsVisited)
51 {
52 auto tile = map.getTile(pos.x, pos.y, pos.z);
53 sp<BattleHazard> existingHazard;
54 for (auto &obj : tile->ownedObjects)
55 {
56 if (obj->getType() == TileObject::Type::Hazard)
57 {
58 existingHazard = std::static_pointer_cast<TileObjectBattleHazard>(obj)->getHazard();
59 break;
60 }
61 }
62 if (existingHazard)
63 {
64 existingHazard->nextUpdateTicksAccumulated = 0;
65 }
66 }
67}
68
69void BattleExplosion::update(GameState &state, unsigned int ticks)
70{

Callers

nothing calls this directly

Calls 3

getTileMethod · 0.80
getHazardMethod · 0.80
getTypeMethod · 0.45

Tested by

no test coverage detected