From c85ac21d84d78016a6a6a3939126b9ad00709d4a Mon Sep 17 00:00:00 2001 From: SopaXorzTaker Date: Tue, 7 Jun 2016 16:07:47 +0300 Subject: [PATCH] Fix gravity field appearing after ctrl+z even if gravity is off, Fixes #293 --- src/simulation/Simulation.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 79d6241f7..044bad473 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -343,10 +343,13 @@ void Simulation::Restore(const Snapshot & snap) std::copy(snap.Particles.begin(), snap.Particles.end(), parts); std::copy(snap.PortalParticles.begin(), snap.PortalParticles.end(), &portalp[0][0][0]); std::copy(snap.WirelessData.begin(), snap.WirelessData.end(), &wireless[0][0]); - std::copy(snap.GravVelocityX.begin(), snap.GravVelocityX.end(), gravx); - std::copy(snap.GravVelocityY.begin(), snap.GravVelocityY.end(), gravy); - std::copy(snap.GravValue.begin(), snap.GravValue.end(), gravp); - std::copy(snap.GravMap.begin(), snap.GravMap.end(), gravmap); + if (grav->ngrav_enable) + { + std::copy(snap.GravVelocityX.begin(), snap.GravVelocityX.end(), gravx); + std::copy(snap.GravVelocityY.begin(), snap.GravVelocityY.end(), gravy); + std::copy(snap.GravValue.begin(), snap.GravValue.end(), gravp); + std::copy(snap.GravMap.begin(), snap.GravMap.end(), gravmap); + } std::copy(snap.BlockMap.begin(), snap.BlockMap.end(), &bmap[0][0]); std::copy(snap.ElecMap.begin(), snap.ElecMap.end(), &emap[0][0]); std::copy(snap.FanVelocityX.begin(), snap.FanVelocityX.end(), &fvx[0][0]);