From 2590a8236a366d62094d1681f38a991aca3e5437 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Mon, 26 Sep 2011 22:11:30 +0000 Subject: [PATCH] Update the kart translation after it was reset at the start of the race. This way getXYZ() and getTrans() now report the correct position after the kart were reset, before the first frame (i.e. before Moveable::update() is called the first time). This caused the referee position to be inconsistent between tracks (and this will for now cause the referee position to be bad ... but at least the same bad in all tracks ;) ). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9897 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/modes/world.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modes/world.cpp b/src/modes/world.cpp index 1e93b2b78..46e116d27 100644 --- a/src/modes/world.cpp +++ b/src/modes/world.cpp @@ -514,16 +514,22 @@ void World::resetAllKarts() } } // while - // Now store the current (i.e. in rest) suspension length for each kart, - // so that the karts can visualise the suspension. for ( KartList::iterator i=m_karts.begin(); i!=m_karts.end(); i++) + { + // Now store the current (i.e. in rest) suspension length for each + // kart, so that the karts can visualise the suspension. (*i)->setSuspensionLength(); - for(unsigned int i=0; igetCamera()) - m_karts[i]->getCamera()->setInitialTransform(); + // Initialise the camera (if available), now that the correct + // kart position is set + if((*i)->getCamera()) + (*i)->getCamera()->setInitialTransform(); + // Update the kart transforms with the newly computed position + // after all karts are reset + (*i)->setTrans((*i)->getBody()->getWorldTransform()); + } } // resetAllKarts - +// ---------------------------------------------------------------------------- void World::schedulePause(Phase phase) { if (m_schedule_unpause) @@ -535,8 +541,9 @@ void World::schedulePause(Phase phase) m_schedule_pause = true; m_scheduled_pause_phase = phase; } -} +} // schedulePause +// ---------------------------------------------------------------------------- void World::scheduleUnpause() { if (m_schedule_pause) @@ -547,7 +554,7 @@ void World::scheduleUnpause() { m_schedule_unpause = true; } -} +} // scheduleUnpause //----------------------------------------------------------------------------- /** This is the main interface to update the world. This function calls