]> git.tdb.fi Git - libs/game.git/commitdiff
Use template lambdas to avoid repetition of types
authorMikko Rasa <tdb@tdb.fi>
Sat, 29 Oct 2022 17:20:55 +0000 (20:20 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 29 Oct 2022 17:20:55 +0000 (20:20 +0300)
source/game/eventbus.h
source/game/transformpropagator.cpp

index e09663589c8c99fe02180db76b94fbe6506af54b..c78cb0d6562bfec062317b6915510daa08916f56 100644 (file)
@@ -23,7 +23,7 @@ struct EventDispatcher
        { handlers.emplace_back(obs, std::move(cb)); }
 
        void remove_observer(EventObserver *obs)
-       { std::erase_if(handlers, [obs](const Handler &h){ return h.observer==obs; }); }
+       { std::erase_if(handlers, [obs](auto &h){ return h.observer==obs; }); }
 
        void dispatch(const T &) const;
 };
index 73ecf6435a7c31e46ce3435cbfef9414a0f4a45c..631e5292bb62eaae215d55f3dd0af183f05c3348 100644 (file)
@@ -12,8 +12,8 @@ TransformPropagator::TransformPropagator(Stage &s):
        System(s),
        observer(s.get_event_bus())
 {
-       observer.observe<Events::EntityCreated>([this](const Events::EntityCreated &){ transforms_dirty = true; });
-       observer.observe<Events::EntityDestroyed>([this](const Events::EntityDestroyed &){ transforms_dirty = true; });
+       observer.observe<Events::EntityCreated>([this](auto &){ transforms_dirty = true; });
+       observer.observe<Events::EntityDestroyed>([this](auto &){ transforms_dirty = true; });
 }
 
 void TransformPropagator::tick(Time::TimeDelta)