From: Mikko Rasa Date: Sat, 29 Oct 2022 21:13:27 +0000 (+0300) Subject: Add a function to remove a system from a stage X-Git-Url: http://git.tdb.fi/?p=libs%2Fgame.git;a=commitdiff_plain;h=38ffef0320a70909f3e13e9681e4720352e440aa Add a function to remove a system from a stage --- diff --git a/source/game/stage.cpp b/source/game/stage.cpp index 779be6e..0eb4238 100644 --- a/source/game/stage.cpp +++ b/source/game/stage.cpp @@ -14,6 +14,11 @@ Stage::Stage(DataFile::Collection &r): Stage::~Stage() { } +void Stage::remove_system(System &s) +{ + erase_if(systems, [&s](auto &p){ return p.get()==&s; }); +} + void Stage::tick(Time::TimeDelta dt) { for(const auto &s: systems) diff --git a/source/game/stage.h b/source/game/stage.h index 6af3b60..d2d05dd 100644 --- a/source/game/stage.h +++ b/source/game/stage.h @@ -46,6 +46,7 @@ public: template T &add_system(Args &&...); + void remove_system(System &); const std::vector> &get_systems() const { return systems; } template