Fixed : the karts were rescued to 'last valid quad - 1'

instead of using the predecessor. So a kart on the first
quad of a short cut would be rescued to an incorrect
location (most likely to the end of the main driveline,
since shortcut quads come just after the main driveline
in the quad.xml). See r9161 on 0.7.2.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9166 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-07-05 01:39:38 +00:00
parent b24f53a3eb
commit 8e0d7789b1

View File

@ -567,12 +567,12 @@ void LinearWorld::moveKartAfterRescue(Kart* kart)
info.m_track_sector = info.m_last_valid_sector;
}
// Removing 1 here makes it less likely to fall in a rescue loop since the
// kart moves back on each attempt. This is still a weak hack. Also some
// other code depends on 1 being substracted, like 'forceRescue'
if ( info.m_track_sector > 0 ) info.m_track_sector-- ;
info.m_last_valid_sector = info.m_track_sector;
if ( info.m_last_valid_sector > 0 ) info.m_last_valid_sector --;
// Using the predecessor has the additional afvantage (besides punishing
// the player a bit more) that it makes it less likely to fall in a
// rescue loop since the kart moves back on each attempt.
const QuadGraph &qg = m_track->getQuadGraph();
info.m_track_sector = qg.getNode(info.m_track_sector).getPredecessor();
info.m_last_valid_sector= qg.getNode(info.m_track_sector).getPredecessor();
kart->setXYZ( m_track->trackToSpatial(info.m_track_sector) );