mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Fix game hang on invalid shooter animation config
This commit is contained in:
@ -756,7 +756,15 @@ void ShootingAnimation::createProjectile(const Point & from, const Point & dest)
|
|||||||
uint32_t ShootingAnimation::getAttackClimaxFrame() const
|
uint32_t ShootingAnimation::getAttackClimaxFrame() const
|
||||||
{
|
{
|
||||||
const CCreature *shooterInfo = getCreature();
|
const CCreature *shooterInfo = getCreature();
|
||||||
return shooterInfo->animation.attackClimaxFrame;
|
|
||||||
|
uint32_t maxFrames = stackAnimation(attackingStack)->framesInGroup(getGroup());
|
||||||
|
uint32_t climaxFrame = shooterInfo->animation.attackClimaxFrame;
|
||||||
|
uint32_t selectedFrame = vstd::clamp(shooterInfo->animation.attackClimaxFrame, 1, maxFrames);
|
||||||
|
|
||||||
|
if (climaxFrame != selectedFrame)
|
||||||
|
logGlobal->warn("Shooter %s has ranged attack climax frame set to %d, but only %d available!", shooterInfo->getNamePluralTranslated(), climaxFrame, maxFrames);
|
||||||
|
|
||||||
|
return selectedFrame - 1; // H3 counts frames from 1
|
||||||
}
|
}
|
||||||
|
|
||||||
ECreatureAnimType ShootingAnimation::getUpwardsGroup() const
|
ECreatureAnimType ShootingAnimation::getUpwardsGroup() const
|
||||||
|
Reference in New Issue
Block a user