fixed times comparison at the end of a lap

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2316 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2008-10-01 01:15:34 +00:00
parent 1c7c08315a
commit dd5069d112

View File

@ -341,7 +341,6 @@ KartIconDisplayInfo* LinearWorld::getKartsDisplayInfo(const RaceGUI* caller)
for(unsigned int i = 0; i < kart_amount ; i++)
{
KartIconDisplayInfo& rank_info = m_kart_display_info[i];
KartInfo& kart_info = m_kart_info[i];
Kart* kart = m_kart[i];
// reset color
@ -354,7 +353,6 @@ KartIconDisplayInfo* LinearWorld::getKartsDisplayInfo(const RaceGUI* caller)
const float lap_time = getTimeAtLapForKart(kart->getWorldKartId());
const int current_lap = getLapForKart( kart->getWorldKartId() );
rank_info.lap = current_lap;
const int position = kart->getPosition();
if(current_lap > laps_of_leader)
{
@ -366,9 +364,19 @@ KartIconDisplayInfo* LinearWorld::getKartsDisplayInfo(const RaceGUI* caller)
// Same number of laps as leader: use fastest time
time_of_leader=std::min(time_of_leader,lap_time);
}
}
// we now know the best time of the lap. fill the remaining bits of info
for(unsigned int i = 0; i < kart_amount ; i++)
{
KartIconDisplayInfo& rank_info = m_kart_display_info[i];
KartInfo& kart_info = m_kart_info[i];
Kart* kart = m_kart[i];
const int position = kart->getPosition();
if(laps_of_leader>0 && // Don't compare times when crossing the start line first
(getTime() - getTimeAtLapForKart(kart->getWorldKartId())<5.0f || current_lap!=laps_of_leader) &&
(getTime() - getTimeAtLapForKart(kart->getWorldKartId())<5.0f || rank_info.lap != laps_of_leader) &&
race_manager->raceHasLaps())
{ // Display for 5 seconds
char str[256];