From 8de12d616efcc5104812657fa40ac92aeac0f62a Mon Sep 17 00:00:00 2001 From: Mark Theng Date: Mon, 5 Sep 2016 09:33:33 +0800 Subject: [PATCH] fix resume simulation/reload in the middle of subframe debugging (#330) --- src/gui/game/GameController.h | 2 +- src/gui/game/GameModel.cpp | 7 +++++++ src/simulation/Simulation.cpp | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/game/GameController.h b/src/gui/game/GameController.h index 5315b71fc..a42228f84 100644 --- a/src/gui/game/GameController.h +++ b/src/gui/game/GameController.h @@ -1,4 +1,4 @@ - #ifndef GAMECONTROLLER_H +#ifndef GAMECONTROLLER_H #define GAMECONTROLLER_H #include diff --git a/src/gui/game/GameModel.cpp b/src/gui/game/GameModel.cpp index 7136dfb0a..93ce26b38 100644 --- a/src/gui/game/GameModel.cpp +++ b/src/gui/game/GameModel.cpp @@ -843,6 +843,13 @@ void GameModel::SetUser(User user) void GameModel::SetPaused(bool pauseState) { + if(!pauseState && sim->debug_currentParticle > 0) + { + sim->UpdateParticles(sim->debug_currentParticle, NPART); + sim->AfterSim(); + sim->debug_currentParticle = 0; + } + sim->sys_pause = pauseState?1:0; notifyPausedChanged(); } diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 5fe3a571a..a625ba9fc 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -1902,6 +1902,7 @@ void Simulation::create_arc(int sx, int sy, int dx, int dy, int midpoints, int v void Simulation::clear_sim(void) { + debug_currentParticle = 0; emp_decor = 0; emp_trigger_count = 0; signs.clear();