From cd9b7052f07291e3975bad5dcfe9ad0338c17e74 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Fri, 15 Dec 2017 15:01:38 +0100 Subject: Add tracers. --- src/game/game.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/game/game.cpp') diff --git a/src/game/game.cpp b/src/game/game.cpp index 96f76d3..1619de0 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -82,6 +82,12 @@ void state_t::command(v2f_t x) } } +void state_t::add_effect(effect_t *effect) +{ + effects.insert(effect); + effect->link(&world); +} + void state_t::tick(double now_, double dt_) { union { @@ -145,6 +151,15 @@ void state_t::tick(double now_, double dt_) i++; } } + + for (auto i = std::begin(effects); i != std::end(effects);) { + if (now > (*i)->ttl) { + (*i)->unlink(); + //delete *i; FIXME + i = effects.erase(i); + } else + i++; + } } roll_params_t::roll_params_t(size_t sides_) -- cgit