diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-12-16 14:21:16 +0100 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-12-16 14:21:16 +0100 |
commit | 8e81450c561b626b919ecce37b61491cbcc8c103 (patch) | |
tree | a568100d1c015a43b176fbf795cb227cddbca7fa /src/game | |
parent | b3ab2d0a77bb154fbeb21745771e3c006b26ffb9 (diff) |
Free effects' memory when they disappear.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game.cpp | 2 | ||||
-rw-r--r-- | src/game/game.hpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index 1619de0..285f75d 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -155,7 +155,7 @@ void state_t::tick(double now_, double dt_) for (auto i = std::begin(effects); i != std::end(effects);) { if (now > (*i)->ttl) { (*i)->unlink(); - //delete *i; FIXME + delete *i; i = effects.erase(i); } else i++; diff --git a/src/game/game.hpp b/src/game/game.hpp index 8949911..fce113d 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -153,6 +153,7 @@ namespace game { double ttl = +INFINITY; effect_t(game::state_t *game_); + virtual ~effect_t() {}; }; class fx_tracer_t : public effect_t { @@ -160,6 +161,7 @@ namespace game { public: fx_tracer_t(game::state_t *game_, v2f_t x0_, v2f_t x1_); + ~fx_tracer_t(void) = default; void render_to(render::state_t *render); }; @@ -169,6 +171,7 @@ namespace game { public: fx_blood_t(game::state_t *game_, v2f_t x_, bool alien_); + ~fx_blood_t(void) = default; void render_to(render::state_t *render); }; }; |