summary refs log tree commit diff stats
path: root/src/simulation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulation.cpp')
-rw-r--r--src/simulation.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/simulation.cpp b/src/simulation.cpp index 98687b6..326526f 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp
@@ -94,8 +94,7 @@ void Simulation::tick(
94{ 94{
95 // Control 95 // Control
96 for (Entity& entity : 96 for (Entity& entity :
97 active_ | 97 entityRange() |
98 entityView() |
99 views::isControllable() | 98 views::isControllable() |
100 views::isNotMoving()) 99 views::isNotMoving())
101 { 100 {
@@ -123,8 +122,7 @@ void Simulation::tick(
123 vec2s lookPos = posInDir(entity.gridPos, lookDir); 122 vec2s lookPos = posInDir(entity.gridPos, lookDir);
124 123
125 for (Entity& block : 124 for (Entity& block :
126 active_ | 125 entityRange() |
127 entityView() |
128 views::atGridPos(lookPos) | 126 views::atGridPos(lookPos) |
129 views::isNotMoving() | 127 views::isNotMoving() |
130 views::canBePushedBy(entity.colliderType) | 128 views::canBePushedBy(entity.colliderType) |
@@ -171,14 +169,12 @@ void Simulation::tick(
171 if (schedule_.step()) 169 if (schedule_.step())
172 { 170 {
173 for (Entity& entity : 171 for (Entity& entity :
174 active_ | 172 entityRange() |
175 entityView() |
176 views::isScheduled() | 173 views::isScheduled() |
177 views::isNotMoving()) 174 views::isNotMoving())
178 { 175 {
179 auto tracks = 176 auto tracks =
180 active_ | 177 entityRange() |
181 entityView() |
182 views::atGridPos(entity.gridPos) | 178 views::atGridPos(entity.gridPos) |
183 views::isTrack(); 179 views::isTrack();
184 180
@@ -214,9 +210,7 @@ void Simulation::tick(
214 210
215 211
216 // Movement 212 // Movement
217 for (Entity& entity : 213 for (Entity& entity : entityRange())
218 active_ |
219 entityView())
220 { 214 {
221 if (entity.moving) 215 if (entity.moving)
222 { 216 {
@@ -331,8 +325,7 @@ bool Simulation::moveEntityOnGrid(
331 325
332 // Can't move into a space that something else is already moving into. 326 // Can't move into a space that something else is already moving into.
333 if (!ranges::empty( 327 if (!ranges::empty(
334 active_ | 328 entityRange() |
335 entityView() |
336 views::isMovingTo(shouldMoveTo) | 329 views::isMovingTo(shouldMoveTo) |
337 views::isOnLayer(entity.layer))) 330 views::isOnLayer(entity.layer)))
338 { 331 {
@@ -340,8 +333,7 @@ bool Simulation::moveEntityOnGrid(
340 } 333 }
341 334
342 for (Entity& block : 335 for (Entity& block :
343 active_ | 336 entityRange() |
344 entityView() |
345 views::atGridPos(shouldMoveTo) | 337 views::atGridPos(shouldMoveTo) |
346 views::isOnLayer(entity.layer)) 338 views::isOnLayer(entity.layer))
347 { 339 {