Moved setting of the position of each kart into

setKartPosition, some simplifications to ftl.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5865 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-09-02 13:38:23 +00:00
parent 3480562b78
commit 1b3778ca6a
4 changed files with 4 additions and 7 deletions

View File

@ -76,7 +76,7 @@ void FollowTheLeaderRace::countdownReachedZero()
{
// In case that the kart on position 1 was removed, we have to set
// the correct position (which equals the remaining number of karts).
m_karts[kart_number]->setPosition(getCurrentNumKarts());
setKartPosition(kart_number, getCurrentNumKarts());
removeKart(kart_number);
}
@ -148,7 +148,6 @@ void FollowTheLeaderRace::getRaceResultOrder(std::vector<int> *order)
int *scores = new int[num_karts];
double *race_time = new double[num_karts];
World *world = World::getWorld();
// Ignore kart 0, since it was the leader
(*order)[0] = -1;
@ -159,9 +158,9 @@ void FollowTheLeaderRace::getRaceResultOrder(std::vector<int> *order)
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( getLapForKart(kart_id) * world->getTrack()->getTrackLength()
if( getLapForKart(kart_id) * getTrack()->getTrackLength()
+ getDistanceDownTrackForKart(kart_id)
> getLapForKart(0) * world->getTrack()->getTrackLength()
> getLapForKart(0) * getTrack()->getTrackLength()
+ getDistanceDownTrackForKart(0))
{
scores[kart_id] = 0;
@ -189,7 +188,6 @@ void FollowTheLeaderRace::getRaceResultOrder(std::vector<int> *order)
for(unsigned int i=1; i<num_karts; i++)
{
world->getKart((*order)[i])->setPosition(i);
setKartPosition((*order)[i], i);
}

View File

@ -689,7 +689,6 @@ void LinearWorld::updateRacePosition()
rank_changed |= kart->getPosition()!=p;
#endif
kart->setPosition(p);
setKartPosition(i, p);
// Switch on faster music if not already done so, if the
// first kart is doing its last lap, and if the estimated

View File

@ -162,7 +162,6 @@ void ThreeStrikesBattle::updateKartRanks()
for( unsigned int n = 0; n < NUM_KARTS; ++n )
{
m_karts[ karts_list[n] ]->setPosition( n+1 );
setKartPosition(karts_list[n], n+1);
}
delete [] karts_list;

View File

@ -31,6 +31,7 @@ void WorldWithRank::setKartPosition(unsigned int kart_id,
unsigned int position)
{
m_position_index[position-1] = kart_id;
m_karts[kart_id]->setPosition(position);
} // setKartPosition
// ----------------------------------------------------------------------------