From 209d679a5673a32e8fc24a4372fdfa1a3739929e Mon Sep 17 00:00:00 2001 From: hikerstk Date: Wed, 12 Aug 2009 02:55:53 +0000 Subject: [PATCH] 'Prepared' bugfix (for once we have a in-race menu): if a player presses esc. after finishing a race in a GP, but before the race is finished, rerunRace() will reset the scores and times to the previous values - but in case of karts who haven't finished the race that was undefined. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3840 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/race/race_manager.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/race/race_manager.cpp b/src/race/race_manager.cpp index 537c7601b..a4552d442 100644 --- a/src/race/race_manager.cpp +++ b/src/race/race_manager.cpp @@ -265,7 +265,19 @@ void RaceManager::startNextRace() else if(m_minor_mode==MINOR_MODE_QUICK_RACE || m_minor_mode==MINOR_MODE_TIME_TRIAL) new StandardRace(); else if(m_minor_mode==MINOR_MODE_3_STRIKES) new ThreeStrikesBattle(); else{ fprintf(stderr,"Could not create given race mode\n"); assert(0); } - + + // Save the current score and set last time to zero. This is necessary + // if someone presses esc after finishing a gp, and selects restart: + // The race is rerun, and the points and scores get reset ... but if + // a kart hasn't finished the race at this stage, last_score and time + // would be undefined. + for(int i=0; igetWorldKartId(); - // In follow the leader mode, kart 0 does not get any points, - // so the position of each kart is actually one better --> decrease pos int pos = kart->getPosition(); assert(pos-1 >= 0);