Fix bug in FTL: if the kart on position 1 was eliminated (i.e. it had

overtaken the leader), and the race is over, the leader was moved back
to position 1 (so that all points are given correct), but the ranks
were not adjusted properly, potentially resulting in duplicated ranks.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7110 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2010-12-20 11:58:10 +00:00
parent ae884476e3
commit 214bf5deec

View File

@@ -127,13 +127,17 @@ void FollowTheLeaderRace::countdownReachedZero()
// this is the case, change the position
if(m_karts[0]->getPosition()!=1)
{
// Adjust the position of all still driving karts except
// the leader by +1, and move the leader to position 1.
// Adjust the position of all still driving karts that
// are ahead of the leader by +1, and move the leader
// to position 1.
for (unsigned int i=1; i<m_karts.size(); i++)
{
if(!m_karts[i]->hasFinishedRace() &&
!m_karts[i]->isEliminated() )
m_karts[i]->setPosition(m_karts[i]->getPosition()+1);
!m_karts[i]->isEliminated() &&
m_karts[i]->getPosition()<m_karts[0]->getPosition())
{
m_karts[i]->setPosition(m_karts[i]->getPosition()+1);
}
}
m_karts[0]->setPosition(1);
}