[colobot] 50/145: Fixed failed assertion when non-damageable objects get fall damage (closes #764)

Didier Raboud odyx at moszumanska.debian.org
Mon Jul 11 12:56:16 UTC 2016


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 0d12dedd90ab3826220f80c6408dd75f5f9f4381
Author: krzys-h <krzys_h at interia.pl>
Date:   Thu Apr 7 20:21:35 2016 +0200

    Fixed failed assertion when non-damageable objects get fall damage (closes #764)
---
 src/physics/physics.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp
index e4013bb..8fcc08c 100644
--- a/src/physics/physics.cpp
+++ b/src/physics/physics.cpp
@@ -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;
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list