99 const tdble drivethrough = 10.0f;
100 const tdble stopandgo = 6.0f + drivethrough;
102 const tdble v0 = 84.0f;
107 if (dv > 1.0f && v1 > 1.0f) {
111 for (i = 0; i < s->_ncars; i++) {
116 car->_penaltyTime += dt + drivethrough;
118 car->_penaltyTime += dt + stopandgo;
129 for (i = 1; i < s->_ncars; i++) {
133 if (s->
cars[j-1]->_penaltyTime > 0.0f) {
134 int l1 =
MIN(s->
cars[j-1]->_laps, s->_totLaps + 1) - 1;
135 int l2 =
MIN(s->
cars[j]->_laps, s->_totLaps + 1) - 1;
150 tdble t1 = s->
cars[j-1]->_curTime + s->
cars[j-1]->_penaltyTime;
158 s->
cars[j]->_pos = j+1;
159 s->
cars[j-1]->_pos = j;
176 const int BUFSIZE = 1024;
181 snprintf(buf, BUFSIZE,
"%sresults/%s/results-%4d-%02d-%02d-%02d-%02d-%02d.xml",
207 const int BUFSIZE = 1024;
208 char path[BUFSIZE], path2[BUFSIZE];
211 for (i = 1; i < nCars + 1; i++) {
233 const int BUFSIZE = 1024;
234 char str1[BUFSIZE], str2[BUFSIZE], path[BUFSIZE], path2[BUFSIZE];
240 maxDrv = curDrv + runDrv;
245 for (i = 0; i < curDrv; i++) {
255 for (i = 0; i < runDrv; i++) {
260 for (j = 0; j < curDrv; j++) {
261 if (!strcmp(carName, standings[j].carName)) {
270 standings[j].
carName = strdup(carName);
280 if (standings[j - 1].points >= standings[j].points) {
285 tmpCarName = standings[j].
carName;
286 modName = standings[j].
modName;
287 drvIdx = standings[j].
drvIdx;
288 points = standings[j].
points;
295 standings[j - 1].
carName = tmpCarName;
296 standings[j - 1].
modName = modName;
297 standings[j - 1].
drvIdx = drvIdx;
298 standings[j - 1].
points = points;
305 for (i = 0; i < curDrv; i++) {
308 free(standings[i].carName);
310 free(standings[i].modName);
316 snprintf(str1, BUFSIZE,
"%sconfig/params.dtd",
GetDataDir());
317 snprintf(str2, BUFSIZE,
"<?xml-stylesheet type=\"text/xsl\" href=\"file:///%sconfig/style.xsl\"?>",
GetDataDir());
335 const int BUFSIZE = 1024;
336 char buf[BUFSIZE], path[BUFSIZE], path2[BUFSIZE];
339 switch (
ReInfo->
s->_raceType) {
342 if (car->_laps > s->_totLaps) car->_laps = s->_totLaps + 1;
350 for (i = 0; i < s->_ncars; i++) {
353 if (car->_laps > s->_totLaps) car->_laps = s->_totLaps + 1;
357 snprintf(buf, BUFSIZE,
"cars/%s/%s.xml", car->_carName, car->_carName);
375 snprintf(path2, BUFSIZE,
"%s/%s/%d", race,
RM_SECT_POINTS, i + 1);
393 for (i = nCars; i > 0; i--) {
398 (car->_bestLapTime != 0.0) &&
399 ((round(car->_bestLapTime*1000.0f) < round(opponentBestLapTime*1000.0f)) || (opponentBestLapTime == 0.0))
419 snprintf(buf, BUFSIZE,
"cars/%s/%s.xml", car->_carName, car->_carName);
427 snprintf(path2, BUFSIZE,
"%s/%s/%d", race,
RM_SECT_POINTS, i + 1);
446 const char *race =
ReInfo->_reRaceName;
448 const int BUFSIZE = 1024;
449 char buf[BUFSIZE], path[BUFSIZE];
450 const int TIMEFMTSIZE = 256;
451 char timefmt[TIMEFMTSIZE];
456 snprintf(buf, BUFSIZE,
"%s on %s - Lap %d", car->_name,
ReInfo->
track->
name, car->_laps);
459 snprintf(buf, BUFSIZE,
"cars/%s/%s.xml", car->_carName, car->_carName);
466 nCars =
MIN(nCars + 1, maxLines);
467 for (i = 1; i < nCars; i++) {
471 GfTime2Str(timefmt, TIMEFMTSIZE, car->_bestLapTime, 0);
472 snprintf(buf, BUFSIZE,
"%d - %s - %s (%s)", i, timefmt, car->_name, carName);
478 snprintf(buf, BUFSIZE,
"%d - %s - %s (%s)", i + printed, timefmt,
GfParmGetStr(results, path,
RE_ATTR_NAME,
""),
GfParmGetStr(results, path,
RE_ATTR_CAR,
""));
483 GfTime2Str(timefmt, TIMEFMTSIZE, car->_bestLapTime, 0);
484 snprintf(buf, BUFSIZE,
"%d - %s - %s (%s)", i, timefmt, car->_name, carName);
489 ReInfo->_refreshDisplay = 1;
497 const int BUFSIZE = 1024;
int nMaxPits
number max of pits
int GfParmSetStr(void *handle, const char *path, const char *key, const char *val)
Set a string parameter in the parameter set handle.
void ReResScreenSetText(const char *text, int line, int clr)
void ReStoreRaceResults(const char *race)
void * GfParmReadFile(const char *file, int mode)
Read parameter set from file and return handle to parameter set.
cars situation used to inform the GUI and the drivers
void ReUpdateStandings(void)
#define RE_SECT_STANDINGS
#define GFPARM_RMODE_STD
if handle already openned return it
#define RE_ATTR_NB_PIT_STOPS
tCarElt ** cars
list of cars
void * results
Race results.
#define TR_PIT_ON_TRACK_SIDE
The pits are on the track side.
void GfParmReleaseHandle(void *parmHandle)
Release given parameter set handle parmHandle.
#define RE_ATTR_BOT_SPEED
Robot Module Interface Definition.
void ReResEraseScreen(void)
void GfParmSetDTD(void *parmHandle, char *dtd, char *header)
Set the dtd path and header.
#define RE_ATTR_BEST_LAP_TIME
tSituation * s
Situation during race.
#define RM_PENALTY_STOPANDGO
int GfParmWriteFile(const char *file, void *parmHandle, const char *name)
Write parameter set into file.
int GfParmCreateDirectory(const char *file, void *parmHandle)
Create directory for parameter set handle if it does not yet exist.
const char * GfParmGetStr(void *parmHandle, const char *path, const char *key, const char *deflt)
Get a string parameter from the parameter set handle.
The Gaming Framework API (client part).
#define RE_ATTR_PENALTYTIME
tdble speedLimit
Speed limit between pitStart and pitEnd.
float tdble
Floating point type used in TORCS.
void ReDisplayStandings(void)
const char * name
Name of the track.
tTrack * track
Current track.
#define RM_PENALTY_DRIVETHROUGH
void ReSavePracticeLap(tCarElt *car)
This is the race information structures.
void ReResScreenSetTitle(char *title)
#define GF_TAILQ_FIRST(head)
First element of a TAILQ.
int GfParmSetNum(void *handle, const char *path, const char *key, const char *unit, tdble val)
Set a numerical parameter in the parameter set handle.
static void ReApplyRaceTimePenalties(void)
tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle.
int GfParmListClean(void *handle, const char *path)
Remove all the subsections in a section in the parameter set handle.
tdble len
Lenght of each pit stop.
#define GF_TAILQ_NEXT(elm, field)
Next element of a TAILQ.
int GfParmGetEltNb(void *handle, const char *path)
Count the number of subsections in a section in the parameter set handle.
#define RM_DISP_MODE_CONSOLE
void GfTime2Str(char *result, int resultSize, tdble sec, int sgn)
Convert a time in seconds (float) to an ascii string.
void ReEventInitResults(void)
void ReUpdateQualifCurRes(tCarElt *car)
Race Engine Car Information about the race.
#define RM_DISP_MODE_NORMAL
#define RE_ATTR_CUR_TRACK
#define RE_ATTR_TOP_SPEED
char * GfParmGetName(void *handle)
Get the name property of the parameter set handle.
tTrackPitInfo pits
Pits information.
void * params
Raceman parameters.
#define GFPARM_RMODE_CREAT
Create the file if doesn't exist.
#define RE_ATTR_CUR_DRIVER
int ReDisplayResults(void)