fixed crash when displaying FTL results
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2515 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
807a76c902
commit
f877e02358
@ -151,6 +151,11 @@ void FollowTheLeaderRace::raceResultOrder( int* order )
|
||||
order[kart_id] = kart_id;
|
||||
scores[kart_id] = race_manager->getKartScore(kart_id);
|
||||
race_time[kart_id] = race_manager->getOverallTime(kart_id);
|
||||
|
||||
// check this kart is not in front of leader. If it is, give a score of 0
|
||||
if(m_kart_info[kart_id].m_race_lap * RaceManager::getTrack()->getTrackLength() + getDistanceDownTrackForKart(kart_id) >
|
||||
m_kart_info[0].m_race_lap * RaceManager::getTrack()->getTrackLength() + getDistanceDownTrackForKart(0))
|
||||
scores[kart_id] = 0;
|
||||
}
|
||||
|
||||
//Bubblesort
|
||||
@ -171,6 +176,7 @@ void FollowTheLeaderRace::raceResultOrder( int* order )
|
||||
}
|
||||
}
|
||||
} while(!sorted);
|
||||
|
||||
for(unsigned int i=1; i<NUM_KARTS; i++)
|
||||
RaceManager::getKart(order[i])->setPosition(i);
|
||||
|
||||
|
@ -336,14 +336,6 @@ void RaceManager::RaceFinished(const Kart *kart, float time)
|
||||
// In follow the leader mode, kart 0 does not get any points,
|
||||
// so the position of each kart is actually one better --> decrease pos
|
||||
int pos = kart->getPosition();
|
||||
if(m_minor_mode==MINOR_MODE_FOLLOW_LEADER)
|
||||
{
|
||||
pos--;
|
||||
// If the position is negative (i.e. follow leader and kart on
|
||||
// position 0) set the score of this kart to the lowest possible
|
||||
// score, since the kart is ahead of the leader
|
||||
if(pos<=0) pos=stk_config->m_max_karts;
|
||||
}
|
||||
|
||||
assert(pos-1 >= 0);
|
||||
assert(pos-1 < (int)m_kart_status.size());
|
||||
|
Loading…
x
Reference in New Issue
Block a user