Fixed 3164026 - lap not counted in snowmountain: when a kart was rescued

it would be set to the last valid sector, and the lap count to the last
valid lap count. If the kart triggered a lap count while being off
track, the lap count would be decremented, but the lap line is already
deactivated, so it would not count again. Since the last valid lap count
was stored to solve an old problem (being reset to before the lap line
would count the lap again), and this is not necessary anymore, the whole
storing of last valid lap was removed.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7529 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-01-24 20:33:14 +00:00
parent f4c2d144fa
commit 67f33edbeb
2 changed files with 5 additions and 8 deletions

View File

@ -60,7 +60,6 @@ void LinearWorld::init()
KartInfo info;
info.m_track_sector = QuadGraph::UNKNOWN_SECTOR;
info.m_last_valid_sector = 0;
info.m_last_valid_race_lap = -1;
info.m_lap_start_time = 0;
m_track->getQuadGraph().findRoadSector(m_karts[n]->getXYZ(),
&info.m_track_sector);
@ -202,7 +201,6 @@ void LinearWorld::update(float dt)
if(kart_info.m_on_road)
{
kart_info.m_last_valid_sector = kart_info.m_track_sector;
kart_info.m_last_valid_race_lap = kart_info.m_race_lap;
}
else
{
@ -241,7 +239,7 @@ void LinearWorld::update(float dt)
}
#ifdef DEBUG
// FIXME: Debug output in case that the double position error occurs again.
// Debug output in case that the double position error occurs again.
std::vector<int> pos_used;
pos_used.resize(kart_amount+1, -99);
for(unsigned int i=0; i<kart_amount; i++)
@ -560,10 +558,10 @@ void LinearWorld::moveKartAfterRescue(Kart* kart)
{
info.m_track_sector = info.m_last_valid_sector;
}
info.m_race_lap = info.m_last_valid_race_lap;
// FIXME - 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'
// 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 --;

View File

@ -55,7 +55,6 @@ private:
* e.g. UNKNOWN_SECTOR can be negative!*/
int m_last_valid_sector; /* used when rescusing, e.g. for invalid shortcuts */
int m_last_valid_race_lap; /* when a kart is rescued, we need to give it back the number of lap it had */
Vec3 m_curr_track_coords;
/** True if the kart is on top of the road path drawn by the drivelines */