]> git.tdb.fi Git - libs/game.git/commitdiff
Add a function to remove a system from a stage
authorMikko Rasa <tdb@tdb.fi>
Sat, 29 Oct 2022 21:13:27 +0000 (00:13 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 29 Oct 2022 22:25:28 +0000 (01:25 +0300)
source/game/stage.cpp
source/game/stage.h

index 779be6e02eeefa39c379d200b7dd5056406b29ea..0eb4238fcff375709404b00e52061730e0694cae 100644 (file)
@@ -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)
index 6af3b60a62596b97d61f833baa0c937c395b063a..d2d05dd986a1c2f21a1f9f59f9a1116d7b330448 100644 (file)
@@ -46,6 +46,7 @@ public:
        template<typename T, typename... Args>
        T &add_system(Args &&...);
 
+       void remove_system(System &);
        const std::vector<std::unique_ptr<System>> &get_systems() const { return systems; }
 
        template<typename T>