From 8e81450c561b626b919ecce37b61491cbcc8c103 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 16 Dec 2017 14:21:16 +0100 Subject: Free effects' memory when they disappear. --- src/game/game.cpp | 2 +- src/game/game.hpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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); }; }; -- cgit