From 050785e37e0271c7b4f59d69b9cf545b788961b6 Mon Sep 17 00:00:00 2001 From: hikerstk <hikerstk@178a84e3-b1eb-0310-8ba1-8eac791a3b58> Date: Thu, 8 Jan 2009 02:01:57 +0000 Subject: [PATCH] Bugfix: Parachutes attached as a result of usage of the parachute item by another kart could not be detached by slowing down. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2860 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/items/attachment.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/items/attachment.cpp b/src/items/attachment.cpp index 22cc31a2b..640365a86 100644 --- a/src/items/attachment.cpp +++ b/src/items/attachment.cpp @@ -54,13 +54,21 @@ Attachment::~Attachment() } // ~Attachment //----------------------------------------------------------------------------- -void Attachment::set(attachmentType _type, float time, Kart *current_kart) +void Attachment::set(attachmentType type, float time, Kart *current_kart) { clear(); - m_holder->selectStep(_type); - m_type = _type; + m_holder->selectStep(type); + m_type = type; m_time_left = time; m_previous_owner = current_kart; + // A parachute can be attached as result of the usage of an item. In this + // case we have to save the current kart speed so that it can be detached + // by slowing down. + if(m_type==POWERUP_PARACHUTE) + { + m_initial_speed = m_kart->getSpeed(); + if(m_initial_speed <= 1.5) m_initial_speed = 1.5; // if going very slowly or backwards, braking won't remove parachute + } } // set // -----------------------------------------------------------------------------