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

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