From 6a5d5f8f7bab46c2567752f7bbabca075b926ce3 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 29 Oct 2022 20:20:55 +0300 Subject: [PATCH] Use template lambdas to avoid repetition of types --- source/game/eventbus.h | 2 +- source/game/transformpropagator.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/game/eventbus.h b/source/game/eventbus.h index e096635..c78cb0d 100644 --- a/source/game/eventbus.h +++ b/source/game/eventbus.h @@ -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; }; diff --git a/source/game/transformpropagator.cpp b/source/game/transformpropagator.cpp index 73ecf64..631e529 100644 --- a/source/game/transformpropagator.cpp +++ b/source/game/transformpropagator.cpp @@ -12,8 +12,8 @@ TransformPropagator::TransformPropagator(Stage &s): System(s), observer(s.get_event_bus()) { - observer.observe([this](const Events::EntityCreated &){ transforms_dirty = true; }); - observer.observe([this](const Events::EntityDestroyed &){ transforms_dirty = true; }); + observer.observe([this](auto &){ transforms_dirty = true; }); + observer.observe([this](auto &){ transforms_dirty = true; }); } void TransformPropagator::tick(Time::TimeDelta) -- 2.45.2