summaryrefslogtreecommitdiff
path: root/src/game/game.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-15 15:01:38 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-12-15 15:01:38 +0100
commitcd9b7052f07291e3975bad5dcfe9ad0338c17e74 (patch)
tree532e33fe82f6335ae63c51e461c1814363c711a6 /src/game/game.cpp
parente91ce36233474222e39ac2732100963fcb55574a (diff)
Add tracers.
Diffstat (limited to 'src/game/game.cpp')
-rw-r--r--src/game/game.cpp15
1 files changed, 15 insertions, 0 deletions
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_)