From 38ffef0320a70909f3e13e9681e4720352e440aa Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 30 Oct 2022 00:13:27 +0300 Subject: [PATCH] Add a function to remove a system from a stage --- source/game/stage.cpp | 5 +++++ source/game/stage.h | 1 + 2 files changed, 6 insertions(+) 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 -- 2.45.2