- fixed a bug found during test related to min / map particle logic

This commit is contained in:
Mark Vejvoda
2011-07-02 02:52:30 +00:00
parent 50347b0a66
commit 8b23634332

View File

@@ -2216,15 +2216,17 @@ void Unit::stopDamageParticles(bool force) {
for(unsigned int i = damageParticleSystems.size()-1; i <= 0; --i) { for(unsigned int i = damageParticleSystems.size()-1; i <= 0; --i) {
UnitParticleSystem *ps = damageParticleSystems[i]; UnitParticleSystem *ps = damageParticleSystems[i];
UnitParticleSystemType *pst = NULL; UnitParticleSystemType *pst = NULL;
int foundParticleIndexType = -1; int foundParticleIndexType = -2;
for(std::map<int, UnitParticleSystem *>::iterator iterMap = damageParticleSystemsInUse.begin(); for(std::map<int, UnitParticleSystem *>::iterator iterMap = damageParticleSystemsInUse.begin();
iterMap != damageParticleSystemsInUse.end(); ++iterMap) { iterMap != damageParticleSystemsInUse.end(); ++iterMap) {
if(iterMap->second == ps) { if(iterMap->second == ps) {
foundParticleIndexType = iterMap->first; foundParticleIndexType = iterMap->first;
if(foundParticleIndexType >= 0) {
pst = type->damageParticleSystemTypes[foundParticleIndexType]; pst = type->damageParticleSystemTypes[foundParticleIndexType];
break; break;
} }
} }
}
if(force == true || pst == NULL || if(force == true || pst == NULL ||
pst->getMinmaxEnabled() == false) { pst->getMinmaxEnabled() == false) {
damageParticleSystemsInUse.erase(foundParticleIndexType); damageParticleSystemsInUse.erase(foundParticleIndexType);
@@ -2242,15 +2244,17 @@ void Unit::checkCustomizedParticleTriggers(bool force) {
for(unsigned int i = damageParticleSystems.size()-1; i <= 0; --i) { for(unsigned int i = damageParticleSystems.size()-1; i <= 0; --i) {
UnitParticleSystem *ps = damageParticleSystems[i]; UnitParticleSystem *ps = damageParticleSystems[i];
UnitParticleSystemType *pst = NULL; UnitParticleSystemType *pst = NULL;
int foundParticleIndexType = -1; int foundParticleIndexType = -2;
for(std::map<int, UnitParticleSystem *>::iterator iterMap = damageParticleSystemsInUse.begin(); for(std::map<int, UnitParticleSystem *>::iterator iterMap = damageParticleSystemsInUse.begin();
iterMap != damageParticleSystemsInUse.end(); ++iterMap) { iterMap != damageParticleSystemsInUse.end(); ++iterMap) {
if(iterMap->second == ps) { if(iterMap->second == ps) {
foundParticleIndexType = iterMap->first; foundParticleIndexType = iterMap->first;
if(foundParticleIndexType >= 0) {
pst = type->damageParticleSystemTypes[foundParticleIndexType]; pst = type->damageParticleSystemTypes[foundParticleIndexType];
break; break;
} }
} }
}
if(force == true || (pst != NULL && pst->getMinmaxEnabled() == true)) { if(force == true || (pst != NULL && pst->getMinmaxEnabled() == true)) {
bool stopParticle = force; bool stopParticle = force;