diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 9b88986d0..14f87fabe 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -61,12 +61,17 @@ void Simulation::Load(const GameSave *originalSave, bool includePressure, Vec2particlesCount; n++) { Particle *tempPart = &save->particles[n]; + auto &type = tempPart->type; + if (!type) + { + continue; + } + tempPart->x += (float)partP.X; tempPart->y += (float)partP.Y; int x = int(tempPart->x + 0.5f); int y = int(tempPart->y + 0.5f); - auto &type = tempPart->type; // Check various scenarios where we are unable to spawn the element, and set type to 0 to block spawning later if (!InBounds(x, y)) @@ -160,6 +165,10 @@ void Simulation::Load(const GameSave *originalSave, bool includePressure, Vec2particlesCount; n++) { Particle tempPart = save->particles[n]; + if (!tempPart.type) + { + continue; + } if (elements[tempPart.type].CreateAllowed) {