made end-of-screen results GUI human-readable in Grands Prix (before it was just a bunch of numbers, some of which didn't make sense to show) first part of this comnmit accidentally committed in previous commit

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2770 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2008-12-25 18:16:49 +00:00
parent a2fe608ef7
commit 18262806d5
4 changed files with 9 additions and 7 deletions

View File

@ -102,7 +102,7 @@ GrandPrixEnd::GrandPrixEnd()
// find which kart ended at rank 'i'
for(unsigned int j=start; j < NUM_KARTS; ++j)
{
if( race_manager->getKartFinalGPRank(j) == i-start )
if( (int)race_manager->getKartFinalGPRank(j) == (int)(i-start) )
{
this_kart_id = j;
break;

View File

@ -173,10 +173,12 @@ Widget *RaceResultsGUI::displayKartList(Widget *w_prev, int *order, float horizo
//This shows position + driver name + time + points earned + total points
if(race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX)
{
sprintf((char*)(score + MAX_STR_LEN * i), "#%d. %s (%d -> %d)",
const int prev_score = race_manager->getKartPrevScore(order[i]);
const int new_score = race_manager->getKartScore(order[i]);
sprintf((char*)(score + MAX_STR_LEN * i), "#%d. %s (%d + %d = %d)",
current_kart->getPosition(), kart_name.c_str(),// sTime,
race_manager->getKartPrevScore(order[i]),
race_manager->getKartScore(order[i]));
prev_score, (new_score - prev_score), new_score);
}
else
{

View File

@ -384,8 +384,8 @@ void RaceManager::RaceFinished(const Kart *kart, float time)
assert(pos-1 >= 0);
assert(pos-1 < (int)m_kart_status.size());
m_kart_status[id].m_last_score = m_kart_status[id].m_score;
m_kart_status[id].m_score += m_score_for_position[pos-1];
m_kart_status[id].m_last_score = m_score_for_position[pos-1];
m_kart_status[id].m_overall_time += time;
m_kart_status[id].m_last_time = time;
m_num_finished_karts ++;
@ -401,7 +401,7 @@ void RaceManager::rerunRace()
// Subtract last score from all karts:
for(int i=0; i<m_num_karts; i++)
{
m_kart_status[i].m_score -= m_kart_status[i].m_last_score;
m_kart_status[i].m_score = m_kart_status[i].m_last_score;
m_kart_status[i].m_overall_time -= m_kart_status[i].m_last_time;
}
world->restartRace();

View File

@ -103,7 +103,7 @@ private:
std::string m_ident; // The .tkkf filename without the .tkkf
std::string m_player_name; // for networked karts
int m_score; // score for this kart
int m_last_score; // needed for restart race
int m_last_score; // needed for restart race, and for race results GUI.
double m_overall_time; // sum of times of all races
double m_last_time; // needed for restart
int m_prev_finish_pos; // previous finished position