MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / think

Method think

src/Battlescape/ExplosionBState.cpp:174–193  ·  view source on GitHub ↗

* Animates explosion sprites. If their animation is finished remove them from the list. * If the list is empty, this state is finished and the actual calculations take place. */

Source from the content-addressed store, hash-verified

172 * If the list is empty, this state is finished and the actual calculations take place.
173 */
174void ExplosionBState::think()
175{
176 for (std::list<Explosion*>::iterator i = _parent->getMap()->getExplosions()->begin(); i != _parent->getMap()->getExplosions()->end();)
177 {
178 if(!(*i)->animate())
179 {
180 delete (*i);
181 i = _parent->getMap()->getExplosions()->erase(i);
182 if (_parent->getMap()->getExplosions()->empty())
183 {
184 explode();
185 return;
186 }
187 }
188 else
189 {
190 ++i;
191 }
192 }
193}
194
195/**
196 * Explosions cannot be cancelled.

Callers

nothing calls this directly

Calls 4

getExplosionsMethod · 0.80
getMapMethod · 0.45
animateMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected