Fix bug 3090183: if the leader in a FTL race is on position
3 just before the last kart is eliminated (and a kart on position 1 will be eliminated), the kart on previous position 2 (after elimination on position 1) will get too many points. This situation is now detected, and the position of the remaining karts are adjusted before scoring. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6583 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
3d992ff7ff
commit
507dd4cbde
@ -117,6 +117,25 @@ void FollowTheLeaderRace::countdownReachedZero()
|
||||
|
||||
if (isRaceOver())
|
||||
{
|
||||
// Handle special FTL situation: the leader is kart number 3 when
|
||||
// the last kart gets eliminated. In this case kart on position 1
|
||||
// is eliminated, and the kart formerly on position 2 is on
|
||||
// position 1, the leader now position 2. In this case the kart
|
||||
// on position 1 would get more points for this victory. So if
|
||||
// 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.
|
||||
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[0]->setPosition(1);
|
||||
}
|
||||
|
||||
// Mark all still racing karts to be finished.
|
||||
for (unsigned int n=0; n<m_karts.size(); n++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user