From 6a903ed132b330f8b6db76c445d22bc886fadf34 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Tue, 15 Oct 2024 23:12:35 -0400 Subject: [PATCH] Fix possible crash when creating stamps The save's blockSize was set one cell too short, so extend it by one (by using RectBetween). This fixes a crash when serializing save data that had particles outside its range. --- src/simulation/Simulation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 2b99eb0b7..bab82c77a 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -312,7 +312,7 @@ void Simulation::Load(const GameSave *save, bool includePressure, Vec2 bloc std::unique_ptr Simulation::Save(bool includePressure, Rect partR) // particle coordinates { - auto blockR = RectSized(partR.pos / CELL, partR.size / CELL); + auto blockR = RectBetween(partR.pos / CELL, (partR.pos + partR.size) / CELL); auto blockP = blockR.pos; auto newSave = std::make_unique(blockR.size);