- bugfix for random animation selection when animation does not use min/max hp

This commit is contained in:
Mark Vejvoda 2011-07-11 22:30:16 +00:00
parent 970fe6a326
commit c108663f02
1 changed files with 14 additions and 0 deletions

View File

@ -311,6 +311,20 @@ Model *SkillType::getAnimation(float animProgress, const Unit *unit,
}
}
}
// Need to make sure the filtered list does NOT include any
// models with min/max hp
if(foundSpecificAnimation == false) {
for(unsigned int i = 0; i < animationAttributes.size(); ++i) {
const AnimationAttributes &attributes = animationAttributes[i];
if(attributes.fromHp == 0 && attributes.toHp == 0) {
modelIndex = i;
foundSpecificAnimation = true;
filteredAnimations.push_back(i);
//printf("SELECTING Model index = %d [%s] model attributes [%d to %d] for unit [%s - %d] with HP = %d\n",i,animations[modelIndex]->getFileName().c_str(),attributes.fromHp,attributes.toHp,unit->getType()->getName().c_str(),unit->getId(),unit->getHp());
//break;
}
}
}
}
if(foundSpecificAnimation == false) {