From 3504fd5080dbcfd0172299c5c6d13895e53ad163 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 23 Feb 2019 12:15:46 -0500 Subject: Removed position caches There aren't going to be enough entities at once for position checking to ever really be a bottleneck, I don't think. Removing the caches makes the range logic a bit more intuitive, and it removes the possibility of accidentally not updating a cache when it needs to be. --- src/views.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/views.h') diff --git a/src/views.h b/src/views.h index 69bd2b5..540dc52 100644 --- a/src/views.h +++ b/src/views.h @@ -55,6 +55,20 @@ namespace views { }); } + inline auto atGridPos(vec2s pos) + { + return ranges::view::filter([pos] (const Entity& entity) { + return entity.gridPos == pos; + }); + } + + inline auto isMovingTo(vec2s pos) + { + return ranges::view::filter([pos] (const Entity& entity) { + return entity.moving && entity.destPos == pos; + }); + } + } -- cgit 1.4.1