Fixed failed assertion when non-damageable objects get fall damage (closes #764)

dev-time-step
krzys-h 2016-04-07 20:21:35 +02:00
parent 71a77c77f6
commit 0d12dedd90
1 changed files with 6 additions and 3 deletions

View File

@ -1576,12 +1576,15 @@ bool CPhysics::EventFrame(const Event &event)
SoundMotor(event.rTime); SoundMotor(event.rTime);
if ( m_bLand && m_fallingHeight != 0.0f ) // if fell if ( m_bLand && m_fallingHeight != 0.0f ) // if fell
{
if (m_object->Implements(ObjectInterfaceType::Damageable))
{ {
float force = (m_fallingHeight - m_object->GetPosition().y) * m_fallDamageFraction; float force = (m_fallingHeight - m_object->GetPosition().y) * m_fallDamageFraction;
if (m_object->DamageObject(DamageType::Fall, force)) if (m_object->DamageObject(DamageType::Fall, force))
{ {
return false; // ugly hack, but works for 0.1.6 release :/ return false; // ugly hack, but works for 0.1.6 release :/
} }
}
m_fallingHeight = 0.0f; m_fallingHeight = 0.0f;
} }