summaryrefslogtreecommitdiff
path: root/src/game/game.cpp
diff options
context:
space:
mode:
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_)