diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 23fa2df2..7cad716b 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -2489,11 +2489,13 @@ void Unit::updateTimedParticles() { UnitParticleSystem *ps = unitParticleSystems[i]; if(ps != NULL) { if(Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) { - if(truncateDecimal(ps->getStartTime()) != 0.0 || truncateDecimal(ps->getEndTime()) != 1.0) { - //printf("Checking for end particle system #%d [%d] [%f] [%f] [%f] [%f]\n",i,ps->shape,truncateDecimal(ps->getStartTime()),truncateDecimal(ps->getEndTime()),truncateDecimal(animProgress),truncateDecimal(lastAnimProgress)); + float particleStartTime = truncateDecimal(ps->getStartTime()); + float particleEndTime = truncateDecimal(ps->getEndTime()); - if(truncateDecimal(getAnimProgressAsFloat()) >= 0.99 || - truncateDecimal(getAnimProgressAsFloat()) >= truncateDecimal(ps->getEndTime())) { + if(particleStartTime != 0.0 || particleEndTime != 1.0) { + //printf("Checking for end particle system #%d [%d] [%f] [%f] [%f] [%f]\n",i,ps->shape,truncateDecimal(ps->getStartTime()),truncateDecimal(ps->getEndTime()),truncateDecimal(animProgress),truncateDecimal(lastAnimProgress)); + float animProgressTime = truncateDecimal(getAnimProgressAsFloat()); + if(animProgressTime >= 0.99 || animProgressTime >= particleEndTime) { //printf("ENDING particle system [%d]\n",ps->shape); ps->fade();