diff options
Diffstat (limited to 'src/sandbox.cpp')
-rw-r--r-- | src/sandbox.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/sandbox.cpp b/src/sandbox.cpp index c6d0294..2c09d77 100644 --- a/src/sandbox.cpp +++ b/src/sandbox.cpp @@ -102,17 +102,24 @@ void Sandbox::simulate_step() { dirty_writeto = {}; const auto [x0, y0] = dirty_curr.bl; const auto [x1, y1] = dirty_curr.tr; + // Clear update bit for this cycle for (_y = y0; _y <= y1; ++_y) { for (_x = x0; _x <= x1; ++_x) { gs(_x, _y).updated = false; } } + + // Update for (_y = y0; _y <= y1; ++_y) { for (_x = x0; _x <= x1; ++_x) { simulate_sand_tile(*this, _x, _y); } } + dirty_writeto.bl -= Pt(1, 1); + dirty_writeto.tr += Pt(1, 1); + dirty_writeto = rect_intersect(dirty_writeto, Rect(0, 0, width - 1, height - 1)); + ++ncycle; } |