TORCS  1.3.9
The Open Racing Car Simulator
raceresults.cpp
Go to the documentation of this file.
1 /***************************************************************************
2 
3  file : raceresults.cpp
4  created : Thu Jan 2 12:43:10 CET 2003
5  copyright : (C) 2002, 2017 by Eric Espie, Bernhard Wymann
6  email : eric.espie@torcs.org
7  version : $Id$
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
26 #include <stdlib.h>
27 #include <stdio.h>
28 #include <time.h>
29 #include <tgfclient.h>
30 #include <robot.h>
31 #include <raceman.h>
32 #include <racescreens.h>
33 #include <robottools.h>
34 #include <portability.h>
35 
36 #include "racemain.h"
37 #include "racegl.h"
38 #include "raceinit.h"
39 #include "raceengine.h"
40 
41 #include "raceresults.h"
42 
43 typedef struct
44 {
45  char *carName;
46  char *modName;
47  int drvIdx;
48  int points;
49 } tReStandings;
50 
51 
52 /*
53  Applies pending penalties after the race:
54  - Time penalties
55  - Pending stop & go (can happen if penalty is given within the last 5 laps)
56  - Pending drive through (dito)
57 
58  I assume that the average track speed is 300km/h (v0), and that the pit entry
59  and exit costs 10s. We call the pit speed limit v1, and the length of the pit
60  lane s. So the time lost with driving through the pit lane is
61  dt = s*(v0-v1)/(v0*v1). We assume that stopping costs additional 6 seconds.
62 
63  Drive through: 10 + dt [s]
64  Stop & Go: 10 + 6 + dt [s]
65 
66  Applying time penalties with cars in different laps is problematic, picture
67  this situation: We have 3 cars running, pos 1 car is right behind the pos 3
68  car (so it will overlap in a moment), pos 3 car is right behind pos 2 car,
69  and pos 2 car has a 30s penalty pending. Now right before the finish line the
70  pos 1 car passes (overlaps) the pos 3 car, so the race is done for pos 1 car,
71  and a moment later for the pos 3 car. But the pos 2 car can finish its last
72  lap, although it has a 30s penalty pending, which would have thrown it behind
73  the pos 3 car, if the overlapping not had happened.
74 
75  So just adding times is not enough (btw. the FIA does just add times... weird).
76 
77  All time penalties are added up and then applied to the ranking like this:
78  We "pump up" the result of the opponents with less laps up to our laps
79  with a simple linear model: opponent_race_time/opponent_laps*our_race_laps, so
80  we are worse when:
81  our_race_time + our_penalty_time >
82  opponent_race_time/opponent_laps*our_race_laps + opponent_penalty_time
83 
84  This works as well for opponents in the same lap, opponent_laps*our_race_laps is
85  then 1. The calculation requires that at least one full lap has been driven by
86  the drivers which are compared.
87 
88  Wrecked cars are considered worse than a penalty.
89 */
90 static void ReApplyRaceTimePenalties(void)
91 {
92  // First update all penalty times, apply pending drive through/stop and go
93  int i;
94  tSituation *s = ReInfo->s;
95  tCarPenalty *penalty;
96  tCarElt* car;
97 
99  const tdble drivethrough = 10.0f;
100  const tdble stopandgo = 6.0f + drivethrough;
101 
102  const tdble v0 = 84.0f;
104  tdble dv = v0 - v1;
105  tdble dt = 0.0;
106 
107  if (dv > 1.0f && v1 > 1.0f) {
108  dt = (ReInfo->track->pits.nMaxPits*ReInfo->track->pits.len)*dv/(v0*v1);
109  }
110 
111  for (i = 0; i < s->_ncars; i++) {
112  car = s->cars[i];
113  penalty = GF_TAILQ_FIRST(&(car->_penaltyList));
114  while (penalty) {
115  if (penalty->penalty == RM_PENALTY_DRIVETHROUGH) {
116  car->_penaltyTime += dt + drivethrough;
117  } else if (penalty->penalty == RM_PENALTY_STOPANDGO) {
118  car->_penaltyTime += dt + stopandgo;
119  } else {
120  GfError("Unknown penalty.");
121  }
122  penalty = GF_TAILQ_NEXT(penalty, link);
123  }
124  }
125  }
126 
127  // Now sort the cars taking into account the penalties
128  int j;
129  for (i = 1; i < s->_ncars; i++) {
130  j = i;
131  while (j > 0) {
132  // Order without penalties is already ok, so if there is no penalty we do not move down
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;
136  // If the drivers did not at least complete one lap we cannot apply the rule, check.
137  // If the cars are wrecked we do not care about penalties.
138  if (
139  l1 < 1 ||
140  l2 < 1 ||
141  (s->raceInfo.maxDammage < s->cars[j-1]->_dammage) ||
142  (s->raceInfo.maxDammage < s->cars[j]->_dammage))
143  {
144  // Because the cars came already presorted, all following cars must be even worse,
145  // so we can break the iteration here.
146  i = s->_ncars; // Break outer loop
147  break; // Break inner loop
148  }
149 
150  tdble t1 = s->cars[j-1]->_curTime + s->cars[j-1]->_penaltyTime;
151  tdble t2 = s->cars[j]->_curTime*tdble(l1)/tdble(l2) + s->cars[j]->_penaltyTime;
152 
153  if (t1 > t2) {
154  // Swap
155  car = s->cars[j];
156  s->cars[j] = s->cars[j-1];
157  s->cars[j-1] = car;
158  s->cars[j]->_pos = j+1;
159  s->cars[j-1]->_pos = j;
160  j--;
161  continue;
162  }
163  }
164  j = 0;
165  }
166  }
167 }
168 
169 
170 void
172 {
173  struct tm *stm;
174  time_t t;
175  void *results;
176  const int BUFSIZE = 1024;
177  char buf[BUFSIZE];
178 
179  t = time(NULL);
180  stm = localtime(&t);
181  snprintf(buf, BUFSIZE, "%sresults/%s/results-%4d-%02d-%02d-%02d-%02d-%02d.xml",
182  GetLocalDir(),
183  ReInfo->_reFilename,
184  stm->tm_year+1900,
185  stm->tm_mon+1,
186  stm->tm_mday,
187  stm->tm_hour,
188  stm->tm_min,
189  stm->tm_sec
190  );
191 
193  results = ReInfo->results;
194  GfParmSetNum(results, RE_SECT_HEADER, RE_ATTR_DATE, NULL, (tdble)t);
195  GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_TRACK, NULL, 1);
196  GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_RACE, NULL, 1);
197  GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_DRIVER, NULL, 1);
198 }
199 
200 void
202 {
203  int nCars;
204  int i;
205  void *results = ReInfo->results;
206  void *params = ReInfo->params;
207  const int BUFSIZE = 1024;
208  char path[BUFSIZE], path2[BUFSIZE];
209 
210  nCars = GfParmGetEltNb(params, RM_SECT_DRIVERS);
211  for (i = 1; i < nCars + 1; i++) {
212  snprintf(path, BUFSIZE, "%s/%s/%d", ReInfo->track->name, RM_SECT_DRIVERS, i);
213  snprintf(path2, BUFSIZE, "%s/%d", RM_SECT_DRIVERS, i);
214  GfParmSetStr(results, path, RE_ATTR_DLL_NAME, GfParmGetStr(params, path2, RM_ATTR_MODULE, ""));
215  GfParmSetNum(results, path, RE_ATTR_INDEX, NULL, GfParmGetNum(params, path2, RM_ATTR_IDX, (char*)NULL, tModInfo::INVALID_INDEX));
216  GfParmSetStr(results, path, RM_ATTR_DRVNAME, GfParmGetStr(params, path2, RM_ATTR_DRVNAME, ""));
217  }
218 }
219 
220 void
222 {
223  int maxDrv;
224  int curDrv;
225  int runDrv;
226  char *modName;
227  int drvIdx;
228  int points;
229  int i, j;
230  int found;
231  tReStandings *standings = 0;
232  void *results = ReInfo->results;
233  const int BUFSIZE = 1024;
234  char str1[BUFSIZE], str2[BUFSIZE], path[BUFSIZE], path2[BUFSIZE];
235 
236  snprintf(path, BUFSIZE, "%s/%s/%s/%s", ReInfo->track->name, RE_SECT_RESULTS, ReInfo->_reRaceName, RE_SECT_RANK);
237 
238  runDrv = GfParmGetEltNb(results, path);
239  curDrv = GfParmGetEltNb(results, RE_SECT_STANDINGS);
240  maxDrv = curDrv + runDrv;
241 
242  standings = (tReStandings *)calloc(maxDrv, sizeof(tReStandings));
243 
244  /* Read the current standings */
245  for (i = 0; i < curDrv; i++) {
246  snprintf(path2, BUFSIZE, "%s/%d", RE_SECT_STANDINGS, i + 1);
247  standings[i].carName = strdup(GfParmGetStr(results, path2, RE_ATTR_NAME, 0));
248  standings[i].modName = strdup(GfParmGetStr(results, path2, RE_ATTR_MODULE, 0));
249  standings[i].drvIdx = (int)GfParmGetNum(results, path2, RE_ATTR_IDX, NULL, 0);
250  standings[i].points = (int)GfParmGetNum(results, path2, RE_ATTR_POINTS, NULL, 0);
251  }
252 
254 
255  for (i = 0; i < runDrv; i++) {
256  /* Search the driver in the standings */
257  found = 0;
258  snprintf(path, BUFSIZE, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, ReInfo->_reRaceName, RE_SECT_RANK, i + 1);
259  const char* carName = GfParmGetStr(results, path, RE_ATTR_NAME, 0);
260  for (j = 0; j < curDrv; j++) {
261  if (!strcmp(carName, standings[j].carName)) {
262  found = 1;
263  break;
264  }
265  }
266 
267  if (!found) {
268  /* Add the new driver */
269  curDrv++;
270  standings[j].carName = strdup(carName);
271  standings[j].modName = strdup(GfParmGetStr(results, path, RE_ATTR_MODULE, 0));
272  standings[j].drvIdx = (int)GfParmGetNum(results, path, RE_ATTR_IDX, NULL, 0);
273  standings[j].points = (int)GfParmGetNum(results, path, RE_ATTR_POINTS, NULL, 0);
274  } else {
275  /* Add the new points */
276  standings[j].points += (int)GfParmGetNum(results, path, RE_ATTR_POINTS, NULL, 0);
277  }
278  /* bubble sort... */
279  while (j > 0) {
280  if (standings[j - 1].points >= standings[j].points) {
281  break;
282  }
283  /* Swap with preceeding */
284  char* tmpCarName;
285  tmpCarName = standings[j].carName;
286  modName = standings[j].modName;
287  drvIdx = standings[j].drvIdx;
288  points = standings[j].points;
289 
290  standings[j].carName = standings[j - 1].carName;
291  standings[j].modName = standings[j - 1].modName;
292  standings[j].drvIdx = standings[j - 1].drvIdx;
293  standings[j].points = standings[j - 1].points;
294 
295  standings[j - 1].carName = tmpCarName;
296  standings[j - 1].modName = modName;
297  standings[j - 1].drvIdx = drvIdx;
298  standings[j - 1].points = points;
299 
300  j--;
301  }
302  }
303 
304  /* Store the standing back */
305  for (i = 0; i < curDrv; i++) {
306  snprintf(path, BUFSIZE, "%s/%d", RE_SECT_STANDINGS, i + 1);
307  GfParmSetStr(results, path, RE_ATTR_NAME, standings[i].carName);
308  free(standings[i].carName);
309  GfParmSetStr(results, path, RE_ATTR_MODULE, standings[i].modName);
310  free(standings[i].modName);
311  GfParmSetNum(results, path, RE_ATTR_IDX, NULL, standings[i].drvIdx);
312  GfParmSetNum(results, path, RE_ATTR_POINTS, NULL, standings[i].points);
313  }
314  free(standings);
315 
316  snprintf(str1, BUFSIZE, "%sconfig/params.dtd", GetDataDir());
317  snprintf(str2, BUFSIZE, "<?xml-stylesheet type=\"text/xsl\" href=\"file:///%sconfig/style.xsl\"?>", GetDataDir());
318 
319  GfParmSetDTD (results, str1, str2);
320  GfParmCreateDirectory(0, results);
321  GfParmWriteFile(0, results, "Results");
322 }
323 
324 
325 void ReStoreRaceResults(const char *race)
326 {
327  int i;
328  int nCars;
329  tCarElt *car;
330  tSituation *s = ReInfo->s;
331  char *carName;
332  void *carparam;
333  void *results = ReInfo->results;
334  void *params = ReInfo->params;
335  const int BUFSIZE = 1024;
336  char buf[BUFSIZE], path[BUFSIZE], path2[BUFSIZE];
337 
338  /* Store the number of laps of the race */
339  switch (ReInfo->s->_raceType) {
340  case RM_TYPE_RACE:
341  car = s->cars[0];
342  if (car->_laps > s->_totLaps) car->_laps = s->_totLaps + 1;
343 
344  snprintf(path, BUFSIZE, "%s/%s/%s", ReInfo->track->name, RE_SECT_RESULTS, race);
345  GfParmListClean(results, path);
346  GfParmSetNum(results, path, RE_ATTR_LAPS, NULL, car->_laps - 1);
347 
349 
350  for (i = 0; i < s->_ncars; i++) {
351  snprintf(path, BUFSIZE, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i + 1);
352  car = s->cars[i];
353  if (car->_laps > s->_totLaps) car->_laps = s->_totLaps + 1;
354 
355  GfParmSetStr(results, path, RE_ATTR_NAME, car->_name);
356 
357  snprintf(buf, BUFSIZE, "cars/%s/%s.xml", car->_carName, car->_carName);
358  carparam = GfParmReadFile(buf, GFPARM_RMODE_STD);
359  carName = GfParmGetName(carparam);
360 
361  GfParmSetStr(results, path, RE_ATTR_CAR, carName);
362  GfParmSetNum(results, path, RE_ATTR_INDEX, NULL, car->index);
363 
364  GfParmSetNum(results, path, RE_ATTR_LAPS, NULL, car->_laps - 1);
365  GfParmSetNum(results, path, RE_ATTR_TIME, NULL, car->_curTime + car->_penaltyTime);
366  GfParmSetNum(results, path, RE_ATTR_PENALTYTIME, NULL, car->_penaltyTime);
367  GfParmSetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, car->_bestLapTime);
368  GfParmSetNum(results, path, RE_ATTR_TOP_SPEED, NULL, car->_topSpeed);
369  GfParmSetNum(results, path, RE_ATTR_DAMMAGES, NULL, car->_dammage);
370  GfParmSetNum(results, path, RE_ATTR_NB_PIT_STOPS, NULL, car->_nbPitStops);
371 
372  GfParmSetStr(results, path, RE_ATTR_MODULE, car->_modName);
373  GfParmSetNum(results, path, RE_ATTR_IDX, NULL, car->_driverIndex);
374 
375  snprintf(path2, BUFSIZE, "%s/%s/%d", race, RM_SECT_POINTS, i + 1);
376  GfParmSetNum(results, path, RE_ATTR_POINTS, NULL,
377  (int)GfParmGetNum(params, path2, RE_ATTR_POINTS, NULL, 0));
378 
379  GfParmReleaseHandle(carparam);
380  }
381  break;
382 
383  case RM_TYPE_PRACTICE:
384  car = s->cars[0];
385  snprintf(path, BUFSIZE, "%s/%s/%s", ReInfo->track->name, RE_SECT_RESULTS, race);
386  GfParmSetStr(results, path, RM_ATTR_DRVNAME, car->_name);
387  break;
388 
389  case RM_TYPE_QUALIF:
390  car = s->cars[0];
391  snprintf(path, BUFSIZE, "%s/%s/%s/%s", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK);
392  nCars = GfParmGetEltNb(results, path);
393  for (i = nCars; i > 0; i--) {
394  snprintf(path, BUFSIZE, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i);
395  float opponentBestLapTime = GfParmGetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, 0);
396 
397  if (
398  (car->_bestLapTime != 0.0) &&
399  ((round(car->_bestLapTime*1000.0f) < round(opponentBestLapTime*1000.0f)) || (opponentBestLapTime == 0.0))
400  ) {
401  /* shift */
402  snprintf(path2, BUFSIZE, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i + 1);
403  GfParmSetStr(results, path2, RE_ATTR_NAME, GfParmGetStr(results, path, RE_ATTR_NAME, ""));
404  GfParmSetStr(results, path2, RE_ATTR_CAR, GfParmGetStr(results, path, RE_ATTR_CAR, ""));
405  GfParmSetNum(results, path2, RE_ATTR_BEST_LAP_TIME, NULL, GfParmGetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, 0));
406  GfParmSetStr(results, path2, RE_ATTR_MODULE, GfParmGetStr(results, path, RM_ATTR_MODULE, ""));
407  GfParmSetNum(results, path2, RE_ATTR_IDX, NULL, GfParmGetNum(results, path, RM_ATTR_IDX, NULL, 0));
408  snprintf(path, BUFSIZE, "%s/%s/%d", race, RM_SECT_POINTS, i + 1);
409  GfParmSetNum(results, path2, RE_ATTR_POINTS, NULL,
410  (int)GfParmGetNum(params, path, RE_ATTR_POINTS, NULL, 0));
411  } else {
412  break;
413  }
414  }
415  /* insert after */
416  snprintf(path, BUFSIZE, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i + 1);
417  GfParmSetStr(results, path, RE_ATTR_NAME, car->_name);
418 
419  snprintf(buf, BUFSIZE, "cars/%s/%s.xml", car->_carName, car->_carName);
420  carparam = GfParmReadFile(buf, GFPARM_RMODE_STD);
421  carName = GfParmGetName(carparam);
422 
423  GfParmSetStr(results, path, RE_ATTR_CAR, carName);
424  GfParmSetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, round(car->_bestLapTime*1000.0f)/1000.0f);
425  GfParmSetStr(results, path, RE_ATTR_MODULE, car->_modName);
426  GfParmSetNum(results, path, RE_ATTR_IDX, NULL, car->_driverIndex);
427  snprintf(path2, BUFSIZE, "%s/%s/%d", race, RM_SECT_POINTS, i + 1);
428  GfParmSetNum(results, path, RE_ATTR_POINTS, NULL,
429  (int)GfParmGetNum(params, path2, RE_ATTR_POINTS, NULL, 0));
430 
431  GfParmReleaseHandle(carparam);
432  break;
433  }
434 }
435 
436 
437 void
439 {
440  int i;
441  int nCars;
442  int printed;
443  int maxLines;
444  void *carparam;
445  char *carName;
446  const char *race = ReInfo->_reRaceName;
447  void *results = ReInfo->results;
448  const int BUFSIZE = 1024;
449  char buf[BUFSIZE], path[BUFSIZE];
450  const int TIMEFMTSIZE = 256;
451  char timefmt[TIMEFMTSIZE];
452 
454  maxLines = ReResGetLines();
455 
456  snprintf(buf, BUFSIZE, "%s on %s - Lap %d", car->_name, ReInfo->track->name, car->_laps);
457  ReResScreenSetTitle(buf);
458 
459  snprintf(buf, BUFSIZE, "cars/%s/%s.xml", car->_carName, car->_carName);
460  carparam = GfParmReadFile(buf, GFPARM_RMODE_STD);
461  carName = GfParmGetName(carparam);
462 
463  printed = 0;
464  snprintf(path, BUFSIZE, "%s/%s/%s/%s", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK);
465  nCars = GfParmGetEltNb(results, path);
466  nCars = MIN(nCars + 1, maxLines);
467  for (i = 1; i < nCars; i++) {
468  snprintf(path, BUFSIZE, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i);
469  if (!printed) {
470  if ((car->_bestLapTime != 0.0) && (car->_bestLapTime < GfParmGetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, 0))) {
471  GfTime2Str(timefmt, TIMEFMTSIZE, car->_bestLapTime, 0);
472  snprintf(buf, BUFSIZE, "%d - %s - %s (%s)", i, timefmt, car->_name, carName);
473  ReResScreenSetText(buf, i - 1, 1);
474  printed = 1;
475  }
476  }
477  GfTime2Str(timefmt, TIMEFMTSIZE, GfParmGetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, 0), 0);
478  snprintf(buf, BUFSIZE, "%d - %s - %s (%s)", i + printed, timefmt, GfParmGetStr(results, path, RE_ATTR_NAME, ""), GfParmGetStr(results, path, RE_ATTR_CAR, ""));
479  ReResScreenSetText(buf, i - 1 + printed, 0);
480  }
481 
482  if (!printed) {
483  GfTime2Str(timefmt, TIMEFMTSIZE, car->_bestLapTime, 0);
484  snprintf(buf, BUFSIZE, "%d - %s - %s (%s)", i, timefmt, car->_name, carName);
485  ReResScreenSetText(buf, i - 1, 1);
486  }
487 
488  GfParmReleaseHandle(carparam);
489  ReInfo->_refreshDisplay = 1;
490 }
491 
492 void
494 {
495  void *results = ReInfo->results;
496  tReCarInfo *info = &(ReInfo->_reCarInfo[car->index]);
497  const int BUFSIZE = 1024;
498  char path[BUFSIZE];
499 
500  snprintf(path, BUFSIZE, "%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, ReInfo->_reRaceName, car->_laps - 1);
501  GfParmSetNum(results, path, RE_ATTR_TIME, NULL, car->_lastLapTime);
502  GfParmSetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, car->_bestLapTime);
503  GfParmSetNum(results, path, RE_ATTR_TOP_SPEED, NULL, info->topSpd);
504  GfParmSetNum(results, path, RE_ATTR_BOT_SPEED, NULL, info->botSpd);
505  GfParmSetNum(results, path, RE_ATTR_DAMMAGES, NULL, car->_dammage);
506 }
507 
508 int
510 {
511  void *params = ReInfo->params;
512 
513  if (ReInfo->_displayMode != RM_DISP_MODE_CONSOLE) {
514  if ((!strcmp(GfParmGetStr(params, ReInfo->_reRaceName, RM_ATTR_DISPRES, RM_VAL_YES), RM_VAL_YES)) ||
515  (ReInfo->_displayMode == RM_DISP_MODE_NORMAL))
516  {
517  RmShowResults(ReInfo->_reGameScreen, ReInfo);
518  } else {
519  ReResShowCont();
520  }
521 
522  return RM_ASYNC | RM_NEXT_STEP;
523  }
524 
525  return RM_SYNC | RM_NEXT_STEP;
526 }
527 
528 
529 void
531 {
532  RmShowStandings(ReInfo->_reGameScreen, ReInfo);
533 }
int maxDammage
Definition: raceman.h:74
int nMaxPits
number max of pits
Definition: track.h:462
#define GfError
Definition: tgf.h:351
tdble topSpd
Definition: raceman.h:123
int GfParmSetStr(void *handle, const char *path, const char *key, const char *val)
Set a string parameter in the parameter set handle.
Definition: params.cpp:2477
void ReResScreenSetText(const char *text, int line, int clr)
Definition: racegl.cpp:384
void ReStoreRaceResults(const char *race)
void * GfParmReadFile(const char *file, int mode)
Read parameter set from file and return handle to parameter set.
Definition: params.cpp:1157
cars situation used to inform the GUI and the drivers
Definition: raceman.h:85
void ReUpdateStandings(void)
#define RE_SECT_STANDINGS
Definition: raceman.h:340
#define RM_TYPE_PRACTICE
Definition: raceman.h:71
#define RM_NEXT_STEP
Definition: raceman.h:48
#define GFPARM_RMODE_STD
if handle already openned return it
Definition: tgf.h:265
void ReResShowCont(void)
Definition: racegl.cpp:426
#define RE_ATTR_NB_PIT_STOPS
Definition: raceman.h:354
tCarElt ** cars
list of cars
Definition: raceman.h:90
#define RE_ATTR_INDEX
Definition: raceman.h:338
#define RE_ATTR_NAME
Definition: raceman.h:344
#define RM_ATTR_DRVNAME
Definition: raceman.h:258
void * results
Race results.
Definition: raceman.h:224
Car structure (tCarElt).
Definition: car.h:455
#define TR_PIT_ON_TRACK_SIDE
The pits are on the track side.
Definition: track.h:460
One penalty.
Definition: car.h:130
char * GetLocalDir(void)
Definition: tgf.cpp:231
void GfParmReleaseHandle(void *parmHandle)
Release given parameter set handle parmHandle.
Definition: params.cpp:1834
#define RE_ATTR_BOT_SPEED
Definition: raceman.h:352
#define RM_SYNC
Definition: raceman.h:42
#define RE_ATTR_CUR_RACE
Definition: raceman.h:333
Robots Tools.
Robot Module Interface Definition.
void ReResEraseScreen(void)
Definition: racegl.cpp:406
#define RE_SECT_HEADER
Definition: raceman.h:329
#define RE_SECT_CURRENT
Definition: raceman.h:332
#define RM_SECT_POINTS
Definition: raceman.h:242
#define RE_ATTR_DAMMAGES
Definition: raceman.h:353
void GfParmSetDTD(void *parmHandle, char *dtd, char *header)
Set the dtd path and header.
Definition: params.cpp:1584
#define RE_ATTR_BEST_LAP_TIME
Definition: raceman.h:349
#define RE_SECT_RESULTS
Definition: raceman.h:341
tSituation * s
Situation during race.
Definition: raceman.h:221
#define RM_PENALTY_STOPANDGO
Definition: car.h:127
char * modName
Definition: raceresults.cpp:46
int GfParmWriteFile(const char *file, void *parmHandle, const char *name)
Write parameter set into file.
Definition: params.cpp:1610
#define RE_SECT_RANK
Definition: raceman.h:342
int GfParmCreateDirectory(const char *file, void *parmHandle)
Create directory for parameter set handle if it does not yet exist.
Definition: params.cpp:1665
const char * GfParmGetStr(void *parmHandle, const char *path, const char *key, const char *deflt)
Get a string parameter from the parameter set handle.
Definition: params.cpp:2311
The Gaming Framework API (client part).
char * carName
Definition: raceresults.cpp:45
#define RE_ATTR_PENALTYTIME
Definition: raceman.h:356
tdble speedLimit
Speed limit between pitStart and pitEnd.
Definition: track.h:470
#define RE_ATTR_TIME
Definition: raceman.h:350
#define RM_TYPE_QUALIF
Definition: raceman.h:72
tRmInfo * ReInfo
Definition: raceengine.cpp:45
#define RE_ATTR_LAPS
Definition: raceman.h:348
#define RE_ATTR_IDX
Definition: raceman.h:347
#define RE_ATTR_POINTS
Definition: raceman.h:355
#define RE_ATTR_DLL_NAME
Definition: raceman.h:337
float tdble
Floating point type used in TORCS.
Definition: tgf.h:48
char * GetDataDir(void)
Definition: tgf.cpp:257
void ReDisplayStandings(void)
#define RM_ATTR_IDX
Definition: raceman.h:266
#define RM_ATTR_MODULE
Definition: raceman.h:265
const char * name
Name of the track.
Definition: track.h:504
tTrack * track
Current track.
Definition: raceman.h:222
#define RM_PENALTY_DRIVETHROUGH
Definition: car.h:126
int ReResGetLines(void)
Definition: racegl.cpp:400
#define RM_TYPE_RACE
Definition: raceman.h:73
void ReSavePracticeLap(tCarElt *car)
#define RE_ATTR_DATE
Definition: raceman.h:330
This is the race information structures.
void ReResScreenSetTitle(char *title)
Definition: racegl.cpp:358
int index
car index
Definition: car.h:457
#define RM_SECT_DRIVERS
Definition: raceman.h:236
void RmShowStandings(void *prevHdle, tRmInfo *info)
Display standings.
Definition: results.cpp:623
#define RM_ATTR_DISPRES
Definition: raceman.h:270
#define GF_TAILQ_FIRST(head)
First element of a TAILQ.
Definition: tgf.h:464
int GfParmSetNum(void *handle, const char *path, const char *key, const char *unit, tdble val)
Set a numerical parameter in the parameter set handle.
Definition: params.cpp:2586
#define RE_ATTR_MODULE
Definition: raceman.h:346
static void ReApplyRaceTimePenalties(void)
Definition: raceresults.cpp:90
tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle.
Definition: params.cpp:2392
void ReInitResults(void)
int GfParmListClean(void *handle, const char *path)
Remove all the subsections in a section in the parameter set handle.
Definition: params.cpp:2221
tRaceAdmInfo raceInfo
Definition: raceman.h:86
tdble len
Lenght of each pit stop.
Definition: track.h:468
#define GF_TAILQ_NEXT(elm, field)
Next element of a TAILQ.
Definition: tgf.h:467
int GfParmGetEltNb(void *handle, const char *path)
Count the number of subsections in a section in the parameter set handle.
Definition: params.cpp:2106
#define RM_DISP_MODE_CONSOLE
Definition: raceman.h:149
int penalty
penalty type
Definition: car.h:132
void GfTime2Str(char *result, int resultSize, tdble sec, int sgn)
Convert a time in seconds (float) to an ascii string.
Definition: tgf.cpp:193
void ReEventInitResults(void)
#define RM_ASYNC
Definition: raceman.h:43
Definition: Endpoint.h:36
void ReUpdateQualifCurRes(tCarElt *car)
Race Engine Car Information about the race.
Definition: raceman.h:115
void RmShowResults(void *, tRmInfo *)
Display results.
Definition: results.cpp:600
#define RM_DISP_MODE_NORMAL
Definition: raceman.h:146
#define RE_ATTR_CUR_TRACK
Definition: raceman.h:334
#define RE_ATTR_TOP_SPEED
Definition: raceman.h:351
char * GfParmGetName(void *handle)
Get the name property of the parameter set handle.
Definition: params.cpp:2057
#define RE_ATTR_CAR
Definition: raceman.h:345
tTrackPitInfo pits
Pits information.
Definition: track.h:514
void * params
Raceman parameters.
Definition: raceman.h:223
#define GFPARM_RMODE_CREAT
Create the file if doesn&#39;t exist.
Definition: tgf.h:267
#define RE_ATTR_CUR_DRIVER
Definition: raceman.h:335
int type
Type of Pit:
Definition: track.h:455
tdble botSpd
Definition: raceman.h:124
#define RM_VAL_YES
Definition: raceman.h:314
int ReDisplayResults(void)