From 3da994c3b8663219be3bd9a8f3cf8a3c91fec76a Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Thu, 23 Jan 2025 01:19:07 +0700 Subject: [PATCH] Prevent heat convection in liquids looking farther than 1px away. --- src/simulation/Simulation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index d91697c77..92f55da07 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -2329,8 +2329,8 @@ void Simulation::UpdateParticles(int start, int end) { float convGravX, convGravY; GetGravityField(x, y, -2.0f, -2.0f, convGravX, convGravY); - auto offsetX = int(std::round(convGravX + x)); - auto offsetY = int(std::round(convGravY + y)); + auto offsetX = std::clamp(int(std::round(convGravX + x)), x-1, x+1); + auto offsetY = std::clamp(int(std::round(convGravY + y)), y-1, y+1); if ((offsetX != x || offsetY != y) && offsetX >= 0 && offsetX < XRES && offsetY >= 0 && offsetY < YRES) {//some heat convection for liquids auto r = pmap[offsetY][offsetX]; if (!(!r || parts[i].type != TYP(r))) {