From 04dac4c02017e04278890fd7c1d3532e177f1252 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Fri, 24 Jan 2025 22:28:50 -0500 Subject: [PATCH] Very safe optimizations --- src/simulation/Simulation.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index b88174cee..5172e0c84 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -2336,10 +2336,14 @@ void Simulation::UpdateParticles(int start, int end) GetGravityField(x, y, -2.0f, -2.0f, convGravX, convGravY); 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 + // Some heat convection for liquids + if (offsetX != x || offsetY != y) + { auto r = pmap[offsetY][offsetX]; - if (!(!r || parts[i].type != TYP(r))) { - if (parts[i].temp>parts[ID(r)].temp) { + if (!(!r || parts[i].type != TYP(r))) + { + if (parts[i].temp>parts[ID(r)].temp) + { auto swappage = parts[i].temp; parts[i].temp = parts[ID(r)].temp; parts[ID(r)].temp = swappage;