1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:53:53 +00:00

Fix invalid casts

This commit is contained in:
scrawl 2013-11-17 04:33:04 +01:00
parent 07251f0fa4
commit e7993ced69

View file

@ -1045,7 +1045,9 @@ void Animation::updateEffects(float duration)
NifOgre::ObjectList& objects = it->mObjects;
for(size_t i = 0; i < objects.mControllers.size() ;i++)
{
static_cast<EffectAnimationValue*> (objects.mControllers[i].getSource().get())->addTime(duration);
EffectAnimationValue* value = dynamic_cast<EffectAnimationValue*>(objects.mControllers[i].getSource().get());
if (value)
value->addTime(duration);
objects.mControllers[i].update();
}
@ -1058,7 +1060,9 @@ void Animation::updateEffects(float duration)
float remainder = objects.mControllers[0].getSource()->getValue() - objects.mMaxControllerLength;
for(size_t i = 0; i < objects.mControllers.size() ;i++)
{
static_cast<EffectAnimationValue*> (objects.mControllers[i].getSource().get())->resetTime(remainder);
EffectAnimationValue* value = dynamic_cast<EffectAnimationValue*>(objects.mControllers[i].getSource().get());
if (value)
value->resetTime(remainder);
}
}
else