summary refs log tree commit diff stats
path: root/src/views.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2019-02-23 12:15:46 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2019-02-23 12:15:46 -0500
commit3504fd5080dbcfd0172299c5c6d13895e53ad163 (patch)
treecaab8e868566262b3aa4d80aa6a06cdf13e7c21d /src/views.h
parent15b511e694f976686fdec1fb9f959f8a92f3b594 (diff)
downloaddispatcher-3504fd5080dbcfd0172299c5c6d13895e53ad163.tar.gz
dispatcher-3504fd5080dbcfd0172299c5c6d13895e53ad163.tar.bz2
dispatcher-3504fd5080dbcfd0172299c5c6d13895e53ad163.zip
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.
Diffstat (limited to 'src/views.h')
-rw-r--r--src/views.h14
1 files changed, 14 insertions, 0 deletions
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 {
55 }); 55 });
56 } 56 }
57 57
58 inline auto atGridPos(vec2s pos)
59 {
60 return ranges::view::filter([pos] (const Entity& entity) {
61 return entity.gridPos == pos;
62 });
63 }
64
65 inline auto isMovingTo(vec2s pos)
66 {
67 return ranges::view::filter([pos] (const Entity& entity) {
68 return entity.moving && entity.destPos == pos;
69 });
70 }
71
58 72
59 73
60} 74}