30#include <racescreens.h>
31#include <robottools.h>
32#include <portability.h>
57 const int BUFSIZE = 1024;
62 snprintf(buf, BUFSIZE,
"%sresults/%s/results-%4d-%02d-%02d-%02d-%02d-%02d.xml",
86 void *results =
ReInfo->results;
87 void *params =
ReInfo->params;
88 const int BUFSIZE = 1024;
89 char path[BUFSIZE], path2[BUFSIZE];
92 for (i = 1; i < nCars + 1; i++) {
113 void *results =
ReInfo->results;
114 const int BUFSIZE = 1024;
115 char str1[BUFSIZE], str2[BUFSIZE], path[BUFSIZE], path2[BUFSIZE];
121 maxDrv = curDrv + runDrv;
126 for (i = 0; i < curDrv; i++) {
136 for (i = 0; i < runDrv; i++) {
141 for (j = 0; j < curDrv; j++) {
142 if (!strcmp(carName, standings[j].carName)) {
151 standings[j].
carName = strdup(carName);
161 if (standings[j - 1].points >= standings[j].points) {
166 tmpCarName = standings[j].
carName;
167 modName = standings[j].
modName;
168 drvIdx = standings[j].
drvIdx;
169 points = standings[j].
points;
176 standings[j - 1].
carName = tmpCarName;
177 standings[j - 1].
modName = modName;
178 standings[j - 1].
drvIdx = drvIdx;
179 standings[j - 1].
points = points;
186 for (i = 0; i < curDrv; i++) {
189 free(standings[i].carName);
191 free(standings[i].modName);
197 snprintf(str1, BUFSIZE,
"%sconfig/params.dtd",
GetDataDir());
198 snprintf(str2, BUFSIZE,
"<?xml-stylesheet type=\"text/xsl\" href=\"file:///%sconfig/style.xsl\"?>",
GetDataDir());
214 void *results =
ReInfo->results;
215 void *params =
ReInfo->params;
216 const int BUFSIZE = 1024;
217 char buf[BUFSIZE], path[BUFSIZE], path2[BUFSIZE];
220 switch (
ReInfo->s->_raceType) {
223 if (car->_laps > s->_totLaps) car->_laps = s->_totLaps + 1;
231 for (i = 0; i < s->_ncars; i++) {
234 if (car->_laps > s->_totLaps) car->_laps = s->_totLaps + 1;
238 snprintf(buf, BUFSIZE,
"cars/%s/%s.xml", car->_carName, car->_carName);
256 snprintf(path2, BUFSIZE,
"%s/%s/%d", race,
RM_SECT_POINTS, i + 1);
274 for (i = nCars; i > 0; i--) {
279 (car->_bestLapTime != 0.0) &&
280 ((round(car->_bestLapTime*1000.0f) < round(opponentBestLapTime*1000.0f)) || (opponentBestLapTime == 0.0))
300 snprintf(buf, BUFSIZE,
"cars/%s/%s.xml", car->_carName, car->_carName);
308 snprintf(path2, BUFSIZE,
"%s/%s/%d", race,
RM_SECT_POINTS, i + 1);
327 const char *race =
ReInfo->_reRaceName;
328 void *results =
ReInfo->results;
329 const int BUFSIZE = 1024;
330 char buf[BUFSIZE], path[BUFSIZE];
331 const int TIMEFMTSIZE = 256;
332 char timefmt[TIMEFMTSIZE];
337 snprintf(buf, BUFSIZE,
"%s on %s - Lap %d", car->_name,
ReInfo->track->name, car->_laps);
340 snprintf(buf, BUFSIZE,
"cars/%s/%s.xml", car->_carName, car->_carName);
347 nCars =
MIN(nCars + 1, maxLines);
348 for (i = 1; i < nCars; i++) {
352 GfTime2Str(timefmt, TIMEFMTSIZE, car->_bestLapTime, 0);
353 snprintf(buf, BUFSIZE,
"%d - %s - %s (%s)", i, timefmt, car->_name, carName);
359 snprintf(buf, BUFSIZE,
"%d - %s - %s (%s)", i + printed, timefmt,
GfParmGetStr(results, path,
RE_ATTR_NAME,
""),
GfParmGetStr(results, path,
RE_ATTR_CAR,
""));
364 GfTime2Str(timefmt, TIMEFMTSIZE, car->_bestLapTime, 0);
365 snprintf(buf, BUFSIZE,
"%d - %s - %s (%s)", i, timefmt, car->_name, carName);
370 ReInfo->_refreshDisplay = 1;
376 void *results =
ReInfo->results;
378 const int BUFSIZE = 1024;
392 void *params =
ReInfo->params;
struct CarElt tCarElt
Car structure (tCarElt).
float tdble
Floating point type used in TORCS.
const char * GfParmGetStr(void *parmHandle, const char *path, const char *key, const char *deflt)
Get a string parameter from the parameter set handle.
int GfParmSetStr(void *handle, const char *path, const char *key, const char *val)
Set a string parameter in the parameter set handle.
tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle.
char * GfParmGetName(void *handle)
Get the name property of the parameter set handle.
int GfParmSetNum(void *handle, const char *path, const char *key, const char *unit, tdble val)
Set a numerical parameter in the parameter set handle.
void GfParmReleaseHandle(void *parmHandle)
Release given parameter set handle parmHandle.
int GfParmCreateDirectory(const char *file, void *parmHandle)
Create directory for parameter set handle if it does not yet exist.
int GfParmWriteFile(const char *file, void *parmHandle, const char *name)
Write parameter set into file.
void GfParmSetDTD(void *parmHandle, char *dtd, char *header)
Set the dtd path and header.
void * GfParmReadFile(const char *file, int mode)
Read parameter set from file and return handle to parameter set.
int GfParmListClean(void *handle, const char *path)
Remove all the subsections in a section in the parameter set handle.
int GfParmGetEltNb(void *handle, const char *path)
Count the number of subsections in a section in the parameter set handle.
void GfTime2Str(char *result, int resultSize, tdble sec, int sgn)
Convert a time in seconds (float) to an ascii string.
void ReResScreenSetText(const char *text, int line, int clr)
void ReResEraseScreen(void)
void ReResScreenSetTitle(char *title)
#define RE_SECT_STANDINGS
#define RE_ATTR_CUR_TRACK
#define RE_ATTR_TOP_SPEED
#define RE_ATTR_BOT_SPEED
#define RE_ATTR_PENALTYTIME
#define RE_ATTR_CUR_DRIVER
#define RM_DISP_MODE_CONSOLE
#define RE_ATTR_BEST_LAP_TIME
#define RE_ATTR_NB_PIT_STOPS
struct Situation tSituation
cars situation used to inform the GUI and the drivers
#define RM_DISP_MODE_NORMAL
void ReApplyRaceTimePenalties(tSituation *s, const tTrackPitInfo *pits)
Apply race time penalties and update same-lap result order.
Race penalty application and penalty-aware race result ordering.
void ReUpdateQualifCurRes(tCarElt *car)
void ReEventInitResults(void)
void ReUpdateStandings(void)
void ReDisplayStandings(void)
void ReSavePracticeLap(tCarElt *car)
void ReStoreRaceResults(const char *race)
int ReDisplayResults(void)
tCarElt ** cars
list of cars
Race Engine Car Information about the race.
#define GFPARM_RMODE_CREAT
Allow an empty in-memory set on file-open failure; does not write a file.
#define GFPARM_RMODE_STD
Return a new handle sharing cached data for this filename, if available.