From 7c3f922406462366a1f7b7ea7736afbb6af4bf0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Thu, 12 Jun 2025 19:15:14 +0200 Subject: [PATCH] Disable pretty powders while loading saves This should and indeed mostly does not have any observable effect because any particle created with create_part for being loaded from a save is overwritten with data from the save anyway. However, if pretty powders is on, create_part uses Simulation::rng to make powders pretty, and that just gets in the way of debugging when relying on determinism. --- src/simulation/Simulation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index fa568be29..29a0b4737 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -8,6 +8,7 @@ #include "client/GameSave.h" #include "common/tpt-compat.h" #include "common/tpt-rand.h" +#include "common/Defer.h" #include "gui/game/Brush.h" #include "elements/EMP.h" #include "elements/LOLZ.h" @@ -78,6 +79,11 @@ void Simulation::Load(const GameSave *save, bool includePressure, Vec2 bloc } }; + auto oldPrettyPowders = pretty_powder; + pretty_powder = false; + Defer restorePrettyPowders([this, oldPrettyPowders]() { + pretty_powder = oldPrettyPowders; + }); std::map soapList; for (int n = 0; n < NPART && n < save->particlesCount; n++) {