From 12261e263d7bafbcdc2396447c0b1f76bebe6fce Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Oct 2013 21:06:19 +0800 Subject: [PATCH] fix bug where Ctrl+X don't delete stacked particles --- src/simulation/Simulation.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 76c0830a6..ceb06a470 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -330,6 +330,12 @@ void Simulation::Restore(const Snapshot & snap) void Simulation::clear_area(int area_x, int area_y, int area_w, int area_h) { + int i = 0; + for (i = 0; i <= parts_lastActiveIndex; i++) { + if (parts[i].type) + if (parts[i].x >= area_x && parts[i].x <= area_x + area_w && parts[i].y >= area_y && parts[i].y <= area_y + area_h) + kill_part(i); + } int cx = 0; int cy = 0; for (cy=0; cy<=area_h; cy++) @@ -340,7 +346,6 @@ void Simulation::clear_area(int area_x, int area_y, int area_w, int area_h) gravWallChanged = true; bmap[(cy+area_y)/CELL][(cx+area_x)/CELL] = 0; emap[(cy+area_y)/CELL][(cx+area_x)/CELL] = 0; - delete_part(cx+area_x, cy+area_y); } } for(int i = signs.size()-1; i >= 0; i--)