Bug #737 - allows hillclimb (laps=0/duration=00:00:01) => race last until s/f line crossed.

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4839 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 92c12ceeca0782ca2e3b2c9434f4548b7f998b5f
Former-commit-id: edb70fbdbe1268b23c0733e8eaf3b23dcb1d3cf9
This commit is contained in:
mungewell 2012-08-09 04:19:48 +00:00
parent dabacd3569
commit 8855f40dea
2 changed files with 27 additions and 33 deletions

View file

@ -545,7 +545,6 @@ ReCarsManageCar(tCarElt *car, bool& bestLapChanged)
car->_currentSector = 0;
if (car->_laps > 1) {
car->_lastLapTime = s->currentTime - info->sTime;
car->_curTime += car->_lastLapTime;
if (car->_bestLapTime != 0) {
car->_deltaBestLapTime = car->_lastLapTime - car->_bestLapTime;
}
@ -576,6 +575,9 @@ ReCarsManageCar(tCarElt *car, bool& bestLapChanged)
car->_timeBeforeNext = 0;
}
}
}
if (car->_laps > 0) {
car->_curTime += s->currentTime - info->sTime;
if (car->_pos != 1 && s->_raceType == RM_TYPE_RACE) {
car->_timeBehindLeader = car->_curTime - s->cars[0]->_curTime;
@ -589,25 +591,12 @@ ReCarsManageCar(tCarElt *car, bool& bestLapChanged)
}
info->sTime = (tdble)s->currentTime;
switch (ReInfo->s->_raceType) {
case RM_TYPE_PRACTICE:
if (ReInfo->_displayMode == RM_DISP_MODE_NONE && s->_ncars <= 1)
ReUpdatePracticeCurRes(car, /*forceNew=*/true);
/* save the lap result */
if (s->_ncars == 1)
ReSavePracticeLap(car);
break;
case RM_TYPE_QUALIF:
if (ReInfo->_displayMode == RM_DISP_MODE_NONE && s->_ncars <= 1)
ReUpdateQualifCurRes(car);
break;
case RM_TYPE_RACE:
if (ReInfo->_displayMode == RM_DISP_MODE_NONE)
ReUpdateRaceCurRes();
break;
if (ReInfo->s->_raceType == RM_TYPE_PRACTICE &&
(car->_laps > 1 || s->_totLaps == 0))
ReSavePracticeLap(car);
}
} else {
if (ReInfo->_displayMode == RM_DISP_MODE_NONE)
{
switch(s->_raceType)
@ -625,7 +614,6 @@ ReCarsManageCar(tCarElt *car, bool& bestLapChanged)
break;
}
}
}
info->topSpd = car->_speed_x;
info->botSpd = car->_speed_x;

View file

@ -703,8 +703,14 @@ ReSavePracticeLap(tCarElt *car)
void *results = ReInfo->results;
tReCarInfo *info = &(ReInfo->_reCarInfo[car->index]);
if (car->_laps == 1) {
/* hack to allow results from practice hillclimb to be recorded (as lap1) */
snprintf(path, sizeof(path), "%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, ReInfo->_reRaceName, 1);
GfParmSetNum(results, path, RE_ATTR_TIME, NULL, (tdble)car->_curTime);
} else {
snprintf(path, sizeof(path), "%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, ReInfo->_reRaceName, car->_laps - 1);
GfParmSetNum(results, path, RE_ATTR_TIME, NULL, (tdble)car->_lastLapTime);
}
GfParmSetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, (tdble)car->_bestLapTime);
GfParmSetNum(results, path, RE_ATTR_TOP_SPEED, NULL, info->topSpd);
GfParmSetNum(results, path, RE_ATTR_BOT_SPEED, NULL, info->botSpd);