From 8b23634332fbef6761325666599e2eeb28b5a206 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 2 Jul 2011 02:52:30 +0000 Subject: [PATCH] - fixed a bug found during test related to min / map particle logic --- source/glest_game/type_instances/unit.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index fc5c0376..6e2512cb 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -2216,13 +2216,15 @@ void Unit::stopDamageParticles(bool force) { for(unsigned int i = damageParticleSystems.size()-1; i <= 0; --i) { UnitParticleSystem *ps = damageParticleSystems[i]; UnitParticleSystemType *pst = NULL; - int foundParticleIndexType = -1; + int foundParticleIndexType = -2; for(std::map::iterator iterMap = damageParticleSystemsInUse.begin(); iterMap != damageParticleSystemsInUse.end(); ++iterMap) { if(iterMap->second == ps) { foundParticleIndexType = iterMap->first; - pst = type->damageParticleSystemTypes[foundParticleIndexType]; - break; + if(foundParticleIndexType >= 0) { + pst = type->damageParticleSystemTypes[foundParticleIndexType]; + break; + } } } if(force == true || pst == NULL || @@ -2242,13 +2244,15 @@ void Unit::checkCustomizedParticleTriggers(bool force) { for(unsigned int i = damageParticleSystems.size()-1; i <= 0; --i) { UnitParticleSystem *ps = damageParticleSystems[i]; UnitParticleSystemType *pst = NULL; - int foundParticleIndexType = -1; + int foundParticleIndexType = -2; for(std::map::iterator iterMap = damageParticleSystemsInUse.begin(); iterMap != damageParticleSystemsInUse.end(); ++iterMap) { if(iterMap->second == ps) { foundParticleIndexType = iterMap->first; - pst = type->damageParticleSystemTypes[foundParticleIndexType]; - break; + if(foundParticleIndexType >= 0) { + pst = type->damageParticleSystemTypes[foundParticleIndexType]; + break; + } } }