Apply patch by Steel to make sure giving up a race can't give you a highscore or challenge

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11762 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2012-10-25 23:17:10 +00:00
parent ddea03ebe5
commit 7195131d14
3 changed files with 24 additions and 12 deletions

View File

@ -427,6 +427,7 @@ bool ChallengeData::raceFinished()
AbstractKart* kart = world->getPlayerKart(0);
if (kart->isEliminated() ) return false;
if (track_name != m_track_id ) return false;
if ((int)world->getNumKarts() < m_num_karts[d] ) return false;
if (m_energy[d] > 0 && kart->getEnergy() < m_energy[d] ) return false;

View File

@ -124,10 +124,7 @@ void StandardRace::endRaceEarly()
int kartid = active_players[i];
int position = getNumKarts() - active_players.size() + 1 + i;
setKartPosition(kartid, position);
m_karts[kartid]->finishedRace(
estimateFinishTimeForKart(m_karts[kartid])
+ worst_time - getTime()
);
m_karts[kartid]->eliminate();
} // Finish the active players
endSetKartPositions();
setPhase(RESULT_DISPLAY_PHASE);

View File

@ -317,10 +317,17 @@ void RaceResultGUI::determineTableLayout()
kart->getKartProperties()->getIconMaterial()->getTexture();
ri->m_kart_icon = icon;
if (kart->isEliminated())
{
ri->m_finish_time_string = core::stringw(_("Eliminated"));
}
else
{
const float time = kart->getFinishTime();
if(time > max_finish_time) max_finish_time = time;
std::string time_string = StringUtils::timeToString(time);
ri->m_finish_time_string = time_string.c_str();
}
core::dimension2du rect =
m_font->getDimension(ri->m_kart_name.c_str());
@ -661,15 +668,22 @@ void RaceResultGUI::determineGPLayout()
ri->m_player = ri->m_is_player_kart
? kart->getController()->getPlayer() : NULL;
if (!kart->isEliminated())
{
float time = race_manager->getOverallTime(kart_id);
ri->m_finish_time_string
= StringUtils::timeToString(time).c_str();
}
else
{
ri->m_finish_time_string = core::stringw(_("Eliminated"));
}
ri->m_start_at = m_time_between_rows * rank;
ri->m_x_pos = (float)UserConfigParams::m_width;
ri->m_y_pos = (float)(m_top+rank*m_distance_between_rows);
int p = race_manager->getKartPrevScore(kart_id);
ri->m_current_displayed_points = (float)p;
ri->m_new_points =
ri->m_new_points = kart->isEliminated() ? 0 :
(float)race_manager->getPositionScore(kart->getPosition());
}