mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-05 16:07:27 +02:00
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.
This commit is contained in:
@@ -312,7 +312,7 @@ void Simulation::Load(const GameSave *save, bool includePressure, Vec2<int> bloc
|
|||||||
|
|
||||||
std::unique_ptr<GameSave> Simulation::Save(bool includePressure, Rect<int> partR) // particle coordinates
|
std::unique_ptr<GameSave> Simulation::Save(bool includePressure, Rect<int> 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 blockP = blockR.pos;
|
||||||
|
|
||||||
auto newSave = std::make_unique<GameSave>(blockR.size);
|
auto newSave = std::make_unique<GameSave>(blockR.size);
|
||||||
|
Reference in New Issue
Block a user