Applied jmimu's patch to fix icons in battle mode.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5953 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-09-10 05:16:52 +00:00
parent 963516e2fb
commit ea7e1e2734
2 changed files with 15 additions and 5 deletions

View File

@ -25,7 +25,7 @@
/**
* A WorldWithRank is a world where the karts are ranked. This is the base
* class for races and battle modes - all of which rank the kart.
* A class using this as a subclass must call setKartRank(kart id, rank)
* A class using this as a subclass must call setKartPosition(kart id, position)
* and this class is used to access the ranks from other objects.
* \ingroup modes
*/

View File

@ -415,7 +415,7 @@ void RaceGUI::drawGlobalPlayerIcons(const KartIconDisplayInfo* info)
y_base = UserConfigParams::m_height/2 + 20;
}
LinearWorld *world = (LinearWorld*)(World::getWorld());
WorldWithRank *world = (WorldWithRank*)(World::getWorld());
//initialize m_previous_icons_position
if(m_previous_icons_position.size()==0)
{
@ -442,7 +442,15 @@ void RaceGUI::drawGlobalPlayerIcons(const KartIconDisplayInfo* info)
for(int position = 1; position <= (int)kart_amount ; position++)
{
const Kart *kart = world->getKartAtPosition(position);
Kart *kart = world->getKartAtPosition(position);
if (kart->getPosition() == -1)//if position is not set
{
//we use karts ordered by id only
//(needed for beginning of MINOR_MODE_3_STRIKES)
kart= world->getKart(position-1);
}
if(kart->isEliminated()) continue;
unsigned int kart_id = kart->getWorldKartId();
@ -457,8 +465,10 @@ void RaceGUI::drawGlobalPlayerIcons(const KartIconDisplayInfo* info)
}
else
{
float distance = world->getDistanceDownTrackForKart(kart_id)
+ world->getTrack()->getTrackLength()*lap;
LinearWorld *linear_world = (LinearWorld*)(World::getWorld());
float distance = linear_world->getDistanceDownTrackForKart(kart_id)
+ linear_world->getTrack()->getTrackLength()*lap;
if ((position>1) && (previous_distance-distance<m_dist_show_overlap) && (!kart->hasFinishedRace()))
{
//linear translation : form (0,ICON_PLAYER_WIDTH+2) to