From 26c5f8540b61a6838580d5b8f9a66402e30b57ff Mon Sep 17 00:00:00 2001 From: hikerstk Date: Sat, 20 Dec 2008 00:21:15 +0000 Subject: [PATCH] Bugfix: a kart that is rescued and eliminated when doing a reset was added twice to the physics world (resulting in bullet assertion errors). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2722 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/karts/kart.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index d46a5fed0..c4992755e 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -307,7 +307,9 @@ void Kart::updatedWeight() //----------------------------------------------------------------------------- void Kart::reset() { - if(m_eliminated) + // If the kart was eliminated or rescued, the body was removed from the + // physics world. add it again. + if(m_eliminated || m_rescue) { RaceManager::getWorld()->getPhysics()->addKart(this, m_vehicle); } @@ -318,6 +320,7 @@ void Kart::reset() m_race_position = 9; m_finished_race = false; m_eliminated = false; + m_rescue = false; m_finish_time = 0.0f; m_zipper_time_left = 0.0f; m_collected_energy = 0; @@ -349,13 +352,6 @@ void Kart::reset() m_vehicle->updateWheelTransform(j, true); } - // if the kart was being rescued when a restart is called, - // add the vehicle back into the physical world! - if(m_rescue) - { - RaceManager::getWorld()->getPhysics()->addKart(this, m_vehicle); - } - m_rescue = false; TerrainInfo::update(getXYZ()); } // reset