summaryrefslogtreecommitdiffstats
path: root/src/physics
diff options
context:
space:
mode:
authorMrSimbax <simbaxlp@gmail.com>2014-03-12 19:43:20 +0100
committerMrSimbax <simbaxlp@gmail.com>2014-03-12 19:43:20 +0100
commit244ca93cf7c224cc855501893701ed556b7425e5 (patch)
tree66e429685b0a7b37feafb81c7b35a4efcbe81a8a /src/physics
parent3bb951119ed26f28d822ed26c622673f1445f526 (diff)
downloadcolobot-244ca93cf7c224cc855501893701ed556b7425e5.tar.gz
colobot-244ca93cf7c224cc855501893701ed556b7425e5.tar.bz2
colobot-244ca93cf7c224cc855501893701ed556b7425e5.zip
Fixed bug with fall damage
If you change the height after overheat, you get damage like you didn't change it at all. For example: overheat when you are 10 meters above the ground, and you fall to place 20 meters deeper, but you get the damage like you fell from 10 meters instead of 30. This commit fix this.
Diffstat (limited to 'src/physics')
-rw-r--r--src/physics/physics.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp
index 0d1c6fe..ad59ec0 100644
--- a/src/physics/physics.cpp
+++ b/src/physics/physics.cpp
@@ -1613,7 +1613,7 @@ bool CPhysics::EventFrame(const Event &event)
if ( m_bLand && m_fallingHeight != 0.0f ) // if fell
{
- float force = m_fallingHeight * m_fallDamageFraction;
+ float force = (m_fallingHeight - m_object->GetPosition(0).y) * m_fallDamageFraction;
m_object->ExploObject(EXPLO_BOUM, force);
m_fallingHeight = 0.0f;
}
@@ -3901,7 +3901,7 @@ Error CPhysics::GetError()
void CPhysics::SetFalling()
{
if (m_fallingHeight == 0.0f && m_floorHeight >= m_minFallingHeight)
- m_fallingHeight = m_floorHeight;
+ m_fallingHeight = m_object->GetPosition(0).y;
}
float CPhysics::GetFallingHeight()