Skip to content

Commit

Permalink
Fix assertion when hitting vault
Browse files Browse the repository at this point in the history
  • Loading branch information
hexagonrecursion committed Aug 23, 2024
1 parent aad5918 commit 7cc2b54
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions colobot-base/src/physics/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2725,10 +2725,8 @@ bool CPhysics::ExploOther(ObjectType iType,
// TODO: implement "killer"?
dynamic_cast<CDamageableObject&>(*pObj).DamageObject(damageType);
}
}

if ( force > 25.0f )
{
float damage = -1.0f;
// TODO: Some function in CShieldedObject. GetCollisionResistance()?
if (oType == OBJECT_DERRICK ||
oType == OBJECT_FACTORY ||
Expand All @@ -2747,11 +2745,8 @@ bool CPhysics::ExploOther(ObjectType iType,
oType == OBJECT_SAFE ||
oType == OBJECT_HUSTON ) // building?
{
assert(pObj->Implements(ObjectInterfaceType::Damageable));
// TODO: implement "killer"?
dynamic_cast<CDamageableObject&>(*pObj).DamageObject(DamageType::Collision, force/400.0f);
damage = force/400.0f;
}

if (oType == OBJECT_MOBILEwa ||
oType == OBJECT_MOBILEta ||
oType == OBJECT_MOBILEfa ||
Expand Down Expand Up @@ -2784,9 +2779,12 @@ bool CPhysics::ExploOther(ObjectType iType,
oType == OBJECT_MOBILErp ||
oType == OBJECT_MOBILEst ) // vehicle?
{
assert(pObj->Implements(ObjectInterfaceType::Damageable));
damage = force/200.0f;
}
if ( force > 25.0f && damage > 0.0f )
{
// TODO: implement "killer"?
dynamic_cast<CDamageableObject&>(*pObj).DamageObject(DamageType::Collision, force/200.0f);
dynamic_cast<CDamageableObject&>(*pObj).DamageObject(DamageType::Collision, damage);
}
}

Expand Down

0 comments on commit 7cc2b54

Please sign in to comment.