From 4062d3d4ef90ee2ce08be0d930f8d2fe6968daa2 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 13 Sep 2015 20:43:11 +0200 Subject: [PATCH] Fixed #633 --- src/object/old_object.cpp | 16 +++++++++++++--- src/physics/physics.cpp | 5 ++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/object/old_object.cpp b/src/object/old_object.cpp index cbe619fb..2df77bb4 100644 --- a/src/object/old_object.cpp +++ b/src/object/old_object.cpp @@ -326,9 +326,6 @@ void COldObject::Simplify() m_auto.reset(); } - m_power = nullptr; - m_cargo = nullptr; - m_main->CreateShortcuts(); } @@ -539,6 +536,19 @@ void COldObject::DestroyObject(DestructionType type) m_team = 0; // Back to neutral on destruction + if (m_power != nullptr) + { + if (m_power->Implements(ObjectInterfaceType::Old)) + dynamic_cast(m_power)->m_transporter = nullptr; + m_power = nullptr; + } + if (m_cargo != nullptr) + { + if (m_cargo->Implements(ObjectInterfaceType::Old)) + dynamic_cast(m_cargo)->m_transporter = nullptr; + m_cargo = nullptr; + } + if ( m_botVar != nullptr ) { if ( Implements(ObjectInterfaceType::Transportable) ) // (*) diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index a269eace..01a40417 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -1578,7 +1578,10 @@ 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; - m_object->DamageObject(DamageType::Fall, force); + if (m_object->DamageObject(DamageType::Fall, force)) + { + return false; // ugly hack, but works for 0.1.6 release :/ + } m_fallingHeight = 0.0f; }