From a6929c51f288415a527c1cf3c4ee478188ac514a Mon Sep 17 00:00:00 2001 From: fgenesis Date: Tue, 30 Apr 2013 00:50:45 +0200 Subject: [PATCH] Fix bug introduced in 0784d1b9dff. Thx Diablodoct0r for reporting. Not sure if bug was harmless, maybe... --- Aquaria/Shot.cpp | 8 +++++++- Aquaria/Shot.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Aquaria/Shot.cpp b/Aquaria/Shot.cpp index 98fac54..757b041 100644 --- a/Aquaria/Shot.cpp +++ b/Aquaria/Shot.cpp @@ -342,6 +342,7 @@ Shot::Shot() : Quad(), Segmented(0,0) fired = false; target = 0; dead = false; + enqueuedForDelete = false; shotIdx = shots.size(); shots.push_back(this); } @@ -487,7 +488,6 @@ void Shot::setLifeTime(float l) void Shot::onEndOfLife() { destroySegments(0.2); - deleteShots.push_back(this); dead = true; if (emitter) @@ -495,6 +495,12 @@ void Shot::onEndOfLife() emitter->killParticleEffect(); emitter = 0; } + + if (!enqueuedForDelete) + { + enqueuedForDelete = true; + deleteShots.push_back(this); + } } void Shot::doHitEffects() diff --git a/Aquaria/Shot.h b/Aquaria/Shot.h index 657a55c..3864dd2 100644 --- a/Aquaria/Shot.h +++ b/Aquaria/Shot.h @@ -128,7 +128,6 @@ public: protected: float waveTimer; - bool fired; void suicide(); @@ -141,6 +140,8 @@ protected: void onEndOfLife(); bool dead; + bool fired; + bool enqueuedForDelete; void onUpdate(float dt); private: