TORCS  1.3.9
The Open Racing Car Simulator
tgf.h
Go to the documentation of this file.
1 /***************************************************************************
2  tgf.h -- Interface file for The Gaming Framework
3  -------------------
4  created : Fri Aug 13 22:32:14 CEST 1999
5  copyright : (C) 1999-2026 by Eric Espie, Bernhard Wymann
6  email : berniw#bluewin.ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
26 #ifndef __TGF__H__
27 #define __TGF__H__
28 
29 #include <stdio.h>
30 #ifndef WIN32
31 #include <sys/param.h>
32 #include <assert.h>
33 #endif /* WIN32 */
34 #include <stdlib.h>
35 #ifdef WIN32
36 #include <windows.h>
37 #endif
38 #include <stdarg.h>
39 #include <cstring>
40 #include <math.h>
41 #include <osspec.h>
42 
43 
44 /* typedef double tdble; */
48 typedef float tdble;
49 
50 extern void GfInit(void);
51 
52 #ifndef MAX
53 #define MAX(x,y) ((x) > (y) ? (x) : (y))
54 #endif
55 
56 #ifndef MIN
57 #define MIN(x,y) ((x) < (y) ? (x) : (y))
58 #endif
59 
60 #define FREEZ(x) do { \
61  if (x) { \
62  free(x); \
63  x = 0; \
64  } \
65 } while (0)
66 
67 #define freez FREEZ
68 
69 const double PI = 3.14159265358979323846;
70 const tdble G = 9.80665f;
72 /* conversion */
73 #define RADS2RPM(x) ((x)*9.549296585)
74 #define RPM2RADS(x) ((x)*.104719755)
75 #define RAD2DEG(x) ((x)*(180.0/PI))
76 #define DEG2RAD(x) ((x)*(PI/180.0))
77 #define FEET2M(x) ((x)*0.304801)
78 #define SIGN(x) ((x) < 0.0f ? -1.0f : 1.0f)
81 #define NORM0_2PI(x) \
82 do { \
83  while ((x) > 2.0*PI) { (x) -= (tdble) (2.0*PI); } \
84  while ((x) < 0.0) { (x) += (tdble) (2.0*PI); } \
85 } while (0)
86 
88 #define NORM_PI_PI(x) \
89 do { \
90  while ((x) > PI) { (x) -= (tdble) (2.0*PI); } \
91  while ((x) < -PI) { (x) += (tdble) (2.0*PI); } \
92 } while (0)
93 
94 
95 #ifndef DIST
96 
97 #define DIST(x1, y1, x2, y2) sqrt(((x1) - (x2)) * ((x1) - (x2)) + ((y1) - (y2)) * ((y1) - (y2)))
98 #endif
99 
100 #ifndef MIN
101 
102 #define MIN(x,y) ((x) < (y) ? (x) : (y))
103 #endif
104 
105 
106 typedef struct {
107  float x;
108  float y;
109  float z;
110 } t3Df;
111 
115 typedef struct {
119 } t3Dd;
120 
121 typedef struct {
122  int x;
123  int y;
124  int z;
125 } t3Di;
126 
130 typedef struct {
137 } tPosd;
138 
142 typedef struct
143 {
147 } tDynPt;
148 
150 typedef struct
151 {
152  t3Dd F;
153  t3Dd M;
154 } tForces;
155 
156 
157 // <esppat>
158 #ifdef WIN32
159 #define malloc _tgf_win_malloc
160 #define calloc _tgf_win_calloc
161 #define realloc _tgf_win_realloc
162 #define free _tgf_win_free
163 #define strdup _tgf_win_strdup
164 #define _strdup _tgf_win_strdup
165 extern void * _tgf_win_malloc(size_t size);
166 extern void * _tgf_win_calloc(size_t num, size_t size);
167 extern void * _tgf_win_realloc(void * memblock, size_t size);
168 extern void _tgf_win_free(void * memblock);
169 extern char * _tgf_win_strdup(const char * str);
170 #endif // WIN32
171 // </esppat>
172 
173 /*********************************
174  * Interface For Dynamic Modules *
175  *********************************/
176 
180 typedef int (*tfModPrivInit)(int index, void *);
181 
185 #define MAX_MOD_ITF 10
186 
188 typedef struct ModInfo {
189  char *name;
190  char *desc;
192  unsigned int gfId;
193  int index;
194  int prio;
195  int magic;
196  enum { INVALID_INDEX = -9999 };
197 } tModInfo;
198 
199 /* module init function interface */
200 typedef int (*tfModInfo)(tModInfo *); /* first function called in the module */
201 
203 typedef struct ModList {
205 #ifdef _WIN32
206  HMODULE handle;
207 #else
208  void *handle;
209 #endif
210  char *sopath;
211  struct ModList *next;
212 } tModList;
213 
214 
215 extern int GfModLoad(unsigned int gfid, char *dllname, tModList **modlist);
216 extern int GfModLoadDir(unsigned int gfid, char *dir, tModList **modlist);
217 extern int GfModUnloadList(tModList **modlist);
218 extern int GfModInfo(unsigned int gfid, char *filename, tModList **modlist);
219 extern int GfModInfoDir(unsigned int gfid, char *dir, int level, tModList **modlist);
220 extern int GfModFreeInfoList(tModList **modlist);
221 
222 /************************
223  * Directory management *
224  ************************/
225 
229 typedef struct FList
230 {
231  struct FList *next;
232  struct FList *prev;
233  char *name;
234  char *dispName;
235  void *userData;
236 } tFList;
237 
238 extern tFList *GfDirGetList(const char *dir);
239 extern tFList *GfDirGetListFiltered(const char *dir, const char *suffix);
240 typedef void (*tfDirfreeUserData)(void*);
241 extern void GfDirFreeList(tFList *list, tfDirfreeUserData freeUserDatabool, bool freename = false, bool freedispname = false);
242 
243 
244 /**********************************
245  * Interface For Parameter Files *
246  **********************************/
247 
248 /*
249  * This set of function is used to store and retrieve
250  * values in parameters files.
251  */
252 
253 
254 /* parameters file type */
255 #define GFPARM_PARAMETER 0
256 #define GFPARM_TEMPLATE 1
257 #define GFPARM_PARAM_STR "param"
258 #define GFPARM_TEMPL_STR "template"
259 
260 /* parameters access mode */
261 #define GFPARM_MODIFIABLE 1
262 #define GFPARM_WRITABLE 2
264 /* parameter file read */
265 #define GFPARM_RMODE_STD 0x01
266 #define GFPARM_RMODE_REREAD 0x02
267 #define GFPARM_RMODE_CREAT 0x04
268 #define GFPARM_RMODE_PRIVATE 0x08
269 
270 extern void *GfParmReadFile(const char *file, int mode);
271 /* parameter file write */
272 extern int GfParmWriteFile(const char *file, void* handle, const char *name);
273 extern int GfParmCreateDirectory(const char *file, void *parmHandle);
274 
275 extern char *GfParmGetName(void *handle);
276 extern char *GfParmGetFileName(void *handle);
277 
278 /* set the dtd and header values */
279 extern void GfParmSetDTD (void *parmHandle, char *dtd, char*header);
280 
281 /* get string parameter value */
282 extern const char *GfParmGetStr(void *handle, const char *path, const char *key, const char *deflt);
283 /* get string parameter value */
284 extern const char *GfParmGetCurStr(void *handle, const char *path, const char *key, const char *deflt);
285 /* set string parameter value */
286 extern int GfParmSetStr(void *handle, const char *path, const char *key, const char *val);
287 /* set string parameter value */
288 extern int GfParmSetCurStr(void *handle, const char *path, const char *key, const char *val);
289 
290 /* get num parameter value */
291 extern tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt);
292 /* get num parameter value */
293 extern tdble GfParmGetCurNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt);
294 /* set num parameter value */
295 extern int GfParmSetNum(void *handle, const char *path, const char *key, const char *unit, tdble val);
296 extern int GfParmSetNumEx(void *handle, const char *path, const char *key, const char *unit, tdble val, tdble min, tdble max);
297 /* set num parameter value */
298 extern int GfParmSetCurNum(void *handle, const char *path, const char *key, const char *unit, tdble val);
299 
300 
301 /* clean all the parameters of a set */
302 extern void GfParmClean(void *handle);
303 /* clean the parms and release the handle without updating the file */
304 extern void GfParmReleaseHandle(void *handle);
305 
306 /* Convert a value in "units" into SI */
307 extern tdble GfParmUnit2SI(const char *unit, tdble val);
308 /* convert a value in SI to "units" */
309 extern tdble GfParmSI2Unit(const char *unit, tdble val);
310 
311 /* compare and merge different handles */
312 extern int GfParmCheckHandle(void *ref, void *tgt);
313 #define GFPARM_MMODE_SRC 1
314 #define GFPARM_MMODE_DST 2
315 #define GFPARM_MMODE_RELSRC 4
316 #define GFPARM_MMODE_RELDST 8
317 extern void *GfParmMergeHandles(void *ref, void *tgt, int mode);
318 extern int GfParmGetNumBoundaries(void *handle, const char *path, const char *key, tdble *min, tdble *max);
319 
320 
321 extern int GfParmGetEltNb(void *handle, const char *path);
322 extern int GfParmListSeekFirst(void *handle, const char *path);
323 extern int GfParmListSeekNext(void *handle, const char *path);
324 extern char *GfParmListGetCurEltName(void *handle, const char *path);
325 extern int GfParmListClean(void *handle, const char *path);
326 
327 /*******************
328  * Trace Interface *
329  *******************/
330 
331 #ifdef WIN32
332 #define GfTrace printf
333 #define GfFatal printf
334 #else
335 
336 #define GfTrace printf
337 
338 static inline void
339 GfFatal(const char *fmt, ...)
340 {
341  va_list ap;
342  va_start(ap, fmt);
343  vprintf(fmt, ap);
344  va_end(ap);
345  /* GfScrShutdown(); */
346  assert (0);
347  exit (1);
348 }
349 #endif
350 
351 #define GfError printf
352 
353 #if !(_DEBUG || DEBUG)
354 //#ifdef WIN32
355 //#define GfOut printf
356 //#else
357 
358 
364 static inline void
365 GfOut(const char *fmt, ...)
366 {
367 }
368 
369 //#endif /* WIN32 */
370 
371 #else /* _DEBUG || DEBUG */
372 
373 #define GfOut printf
374 
375 #endif /* _DEBUG || DEBUG */
376 
377 /*******************
378  * Time Interface *
379  *******************/
380 extern double GfTimeClock(void);
381 
382 /* Mean values */
383 #define GF_MEAN_MAX_VAL 5
384 
385 typedef struct
386 {
387  int curNum;
389 } tMeanVal;
390 
391 extern tdble gfMean(tdble v, tMeanVal *pvt, int n, int w);
392 extern void gfMeanReset(tdble v, tMeanVal *pvt);
393 
394 /* MISC */
395 extern char *GetLocalDir(void);
396 extern void SetLocalDir(char *buf);
397 extern char *GetLibDir(void);
398 extern void SetLibDir(char *buf);
399 extern char *GetDataDir(void);
400 extern void SetDataDir(char *buf);
401 extern int GetSingleTextureMode (void);
402 extern void SetSingleTextureMode (void);
403 extern int GfNearestPow2 (int x);
404 extern int GfCreateDir(char *path);
405 extern int GfCreateDirForFile(const char *filenameandpath);
406 
407 
408 /*
409  * Copyright (c) 1991, 1993
410  * The Regents of the University of California. All rights reserved.
411  *
412  * Redistribution and use in source and binary forms, with or without
413  * modification, are permitted provided that the following conditions
414  * are met:
415  * 1. Redistributions of source code must retain the above copyright
416  * notice, this list of conditions and the following disclaimer.
417  * 2. Redistributions in binary form must reproduce the above copyright
418  * notice, this list of conditions and the following disclaimer in the
419  * documentation and/or other materials provided with the distribution.
420  * 3. All advertising materials mentioning features or use of this software
421  * must display the following acknowledgement:
422  * This product includes software developed by the University of
423  * California, Berkeley and its contributors.
424  * 4. Neither the name of the University nor the names of its contributors
425  * may be used to endorse or promote products derived from this software
426  * without specific prior written permission.
427  *
428  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
429  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
430  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
431  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
432  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
433  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
434  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
435  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
436  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
437  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
438  * SUCH DAMAGE.
439  *
440  * @(#)queue.h 8.5 (Berkeley) 8/20/94
441  */
442 
443 /*
444  * Tail queue definitions.
445  */
448 #define GF_TAILQ_HEAD(name, type) \
449 typedef struct name { \
450  type *tqh_first; /* first element */ \
451  type **tqh_last; /* addr of last next element */ \
452 } t ## name
453 
456 #define GF_TAILQ_ENTRY(type) \
457 struct { \
458  type *tqe_next; /* next element */ \
459  type **tqe_prev; /* address of previous next element */ \
460 }
461 
464 #define GF_TAILQ_FIRST(head) ((head)->tqh_first)
465 
467 #define GF_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
468 
470 #define GF_TAILQ_END(head) NULL
471 
473 #define GF_TAILQ_LAST(head, headname) \
474  (*(((struct headname *)((head)->tqh_last))->tqh_last))
475 
477 #define GF_TAILQ_PREV(elm, headname, field) \
478  (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
479 
480 /*
481  * Tail queue functions.
482  */
485 #define GF_TAILQ_INIT(head) do { \
486  (head)->tqh_first = NULL; \
487  (head)->tqh_last = &(head)->tqh_first; \
488 } while (0)
489 
492 #define GF_TAILQ_INIT_ENTRY(elm, field) do { \
493  (elm)->field.tqe_next = 0; \
494  (elm)->field.tqe_prev = 0; \
495 } while (0)
496 
499 #define GF_TAILQ_INSERT_HEAD(head, elm, field) do { \
500  if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
501  (head)->tqh_first->field.tqe_prev = \
502  &(elm)->field.tqe_next; \
503  else \
504  (head)->tqh_last = &(elm)->field.tqe_next; \
505  (head)->tqh_first = (elm); \
506  (elm)->field.tqe_prev = &(head)->tqh_first; \
507 } while (0)
508 
511 #define GF_TAILQ_INSERT_TAIL(head, elm, field) do { \
512  (elm)->field.tqe_next = NULL; \
513  (elm)->field.tqe_prev = (head)->tqh_last; \
514  *(head)->tqh_last = (elm); \
515  (head)->tqh_last = &(elm)->field.tqe_next; \
516 } while (0)
517 
520 #define GF_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
521  if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
522  (elm)->field.tqe_next->field.tqe_prev = \
523  &(elm)->field.tqe_next; \
524  else \
525  (head)->tqh_last = &(elm)->field.tqe_next; \
526  (listelm)->field.tqe_next = (elm); \
527  (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
528 } while (0)
529 
532 #define GF_TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
533  (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
534  (elm)->field.tqe_next = (listelm); \
535  *(listelm)->field.tqe_prev = (elm); \
536  (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
537 } while (0)
538 
541 #define GF_TAILQ_REMOVE(head, elm, field) do { \
542  if (((elm)->field.tqe_next) != NULL) \
543  (elm)->field.tqe_next->field.tqe_prev = \
544  (elm)->field.tqe_prev; \
545  else \
546  (head)->tqh_last = (elm)->field.tqe_prev; \
547  *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
548 } while (0)
549 
550 
551 /* author : Henrik Enqvist IB (henqvist@abo.fi) */
552 #ifdef PROFILER
553 
554 #include <vector>
555 #include <map>
556 
557 #define START_PROFILE(name) Profiler::getInstance()->startProfile(name)
558 #define STOP_PROFILE(name) Profiler::getInstance()->stopProfile()
559 #define STOP_ACTIVE_PROFILES() Profiler::getInstance()->stopActiveProfiles()
560 #define PRINT_PROFILE() Profiler::getInstance()->printProfile()
561 
562 class ProfileInstance {
563  public:
564  ProfileInstance(const char * pname);
565  ~ProfileInstance();
566  char name[256];
567  int calls;
568  int openCalls;
569  double totalTime;
570  double addTime;
571  double subTime;
572  double tmpStart;
573  std::map<ProfileInstance *, void *> mapChildren;
574 };
575 
577 class Profiler {
578  protected:
579  Profiler();
580  public:
581  ~Profiler();
582  static Profiler * getInstance();
583  void startProfile(const char * pname);
584  void stopProfile();
585  void stopActiveProfiles();
586  void printProfile();
587  private:
588  static Profiler * profiler;
589  ProfileInstance * curProfile;
590  double fStartTime;
591  std::vector<ProfileInstance *> vecProfiles;
592  std::vector<ProfileInstance *> stkProfiles;
593  std::map<ProfileInstance *, void *> mapWarning;
594 };
595 
596 #else /* PROFILER */
597 #define START_PROFILE(a)
598 #define STOP_PROFILE(a)
599 #define STOP_ACTIVE_PROFILES()
600 #define PRINT_PROFILE()
601 #endif
602 
603 /*******************/
604 /* Hash Tables */
605 /*******************/
606 #define GF_HASH_TYPE_STR 0
607 #define GF_HASH_TYPE_BUF 1
609 typedef void (*tfHashFree)(const void*);
611 void *GfHashCreate(int type);
612 int GfHashAddStr(void *hash, const char *key, const void *data);
613 const void *GfHashRemStr(void *hash, char *key);
614 const void *GfHashGetStr(void *hash, const char *key);
615 void GfHashAddBuf(void *hash, char *key, size_t sz, void *data);
616 const void *GfHashRemBuf(void *hash, char *key, size_t sz);
617 const void *GfHashGetBuf(void *hash, char *key, size_t sz);
618 void GfHashRelease(void *hash, tfHashFree hashFree);
619 const void *GfHashGetFirst(void *hash);
620 const void *GfHashGetNext(void *hash);
621 
622 #define GF_DIR_CREATION_FAILED 0
623 #define GF_DIR_CREATED 1
624 
625 #endif /* __TGF__H__ */
626 
627 
int x
Definition: tgf.h:122
int(* tfModPrivInit)(int index, void *)
initialisation of the function table
Definition: tgf.h:180
#define GF_MEAN_MAX_VAL
Definition: tgf.h:383
void SetLibDir(char *buf)
Definition: tgf.cpp:250
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
unsigned int gfId
supported framework version
Definition: tgf.h:192
tFList * GfDirGetListFiltered(const char *dir, const char *suffix)
Get the list of files with matching suffix of a given directory.
Definition: directory.cpp:59
int GfModLoad(unsigned int gfid, char *dllname, tModList **modlist)
Load the specified DLLs.
Definition: module.cpp:57
tModInfo modInfo[MAX_MOD_ITF]
module info list for this dll
Definition: tgf.h:204
tdble GfParmUnit2SI(const char *unit, tdble val)
Convert a value given in unit to SI.
Definition: params.cpp:1944
tdble gfMean(tdble v, tMeanVal *pvt, int n, int w)
Definition: tgf.cpp:157
static void GfFatal(const char *fmt,...)
Definition: tgf.h:339
void * userData
User data.
Definition: tgf.h:235
int GfParmCheckHandle(void *ref, void *tgt)
Check the values in the parameter set tgt against the min/max/within definitions in the ref parameter...
Definition: params.cpp:2728
void * GfParmReadFile(const char *file, int mode)
Read parameter set from file and return handle to parameter set.
Definition: params.cpp:1157
void(* tfHashFree)(const void *)
Function to call for releasing the user data associated with hash table.
Definition: tgf.h:609
tdble y
y coordinate
Definition: tgf.h:132
float z
Definition: tgf.h:109
Definition: tgf.h:385
int GfModInfoDir(unsigned int gfid, char *dir, int level, tModList **modlist)
Get the generic module information of the DLLs of the specified directory.
Definition: module.cpp:129
Scalar max(Scalar x, Scalar y)
Definition: Basic.h:50
int GfParmListSeekNext(void *handle, const char *path)
Go the the next subsection element in the parameter set handle.
Definition: params.cpp:2184
int curNum
Definition: tgf.h:387
int GfParmSetNumEx(void *handle, const char *path, const char *key, const char *unit, tdble val, tdble min, tdble max)
Set a numerical parameter in the parameter set handle including min and max.
Definition: params.cpp:2629
int GfCreateDir(char *path)
Create directory for given path recursively, so all missing parent directories are created as well...
Definition: tgf.cpp:309
int GfModInfo(unsigned int gfid, char *filename, tModList **modlist)
Get the generic information of the specified DLL.
Definition: module.cpp:110
struct ModList * next
next module in list
Definition: tgf.h:211
const void * GfHashGetNext(void *hash)
Get the next user data of a hash table, this is used for table scans.
Definition: hash.cpp:396
void GfParmReleaseHandle(void *handle)
Release given parameter set handle parmHandle.
Definition: params.cpp:1834
tdble GfParmGetCurNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle based on subsection iteration.
Definition: params.cpp:2435
tPosd acc
acceleration
Definition: tgf.h:146
#define MAX_MOD_ITF
Maximum number of interface in one DLL.
Definition: tgf.h:185
int prio
priority if needed
Definition: tgf.h:194
const void * GfHashGetFirst(void *hash)
Get the first user data of a hash table, this is used for table scans.
Definition: hash.cpp:379
void GfHashRelease(void *hash, tfHashFree hashFree)
Release a hash table.
Definition: hash.cpp:353
void GfParmSetDTD(void *parmHandle, char *dtd, char *header)
Set the dtd path and header.
Definition: params.cpp:1584
const void * GfHashGetBuf(void *hash, char *key, size_t sz)
Get the user data associated with a memory buffer key.
Definition: hash.cpp:330
const double PI
PI.
Definition: tgf.h:69
Definition: tgf.h:106
List of (DLL) files for a Directory.
Definition: tgf.h:229
int GfParmWriteFile(const char *file, void *handle, const char *name)
Write parameter set into file.
Definition: params.cpp:1610
float y
Definition: tgf.h:108
const void * GfHashGetStr(void *hash, const char *key)
Get the user data associated with a string key.
Definition: hash.cpp:245
tdble GfParmSI2Unit(const char *unit, tdble val)
Convert a value from SI to given unit.
Definition: params.cpp:1998
int GfParmCreateDirectory(const char *file, void *parmHandle)
Create directory for parameter set handle if it does not yet exist.
Definition: params.cpp:1665
tdble ay
angle along y axis
Definition: tgf.h:135
t3Dd F
Forces.
Definition: tgf.h:152
const char * GfParmGetStr(void *handle, const char *path, const char *key, const char *deflt)
Get a string parameter from the parameter set handle.
Definition: params.cpp:2311
void GfHashAddBuf(void *hash, char *key, size_t sz, void *data)
Add an element with a memory buffer key to a hash table.
Definition: hash.cpp:271
struct FList tFList
List of (DLL) files for a Directory.
int GfNearestPow2(int x)
Definition: tgf.cpp:285
int y
Definition: tgf.h:123
#define dllname
char * GfParmListGetCurEltName(void *handle, const char *path)
Get current subsection name of the parameter set handle during subsection iteration.
Definition: params.cpp:2268
struct ModList tModList
list of module interfaces
const void * GfHashRemBuf(void *hash, char *key, size_t sz)
Remove an element with a memory buffer key from a hash table.
Definition: hash.cpp:303
int GfParmListSeekFirst(void *handle, const char *path)
Go the the first subsection element in the parameter set handle.
Definition: params.cpp:2148
int GfParmGetNumBoundaries(void *handle, const char *path, const char *key, tdble *min, tdble *max)
Get the min and max of a numerical parameter from the parameter set handle.
Definition: params.cpp:3101
char * GetLocalDir(void)
Definition: tgf.cpp:231
char * GetLibDir(void)
Definition: tgf.cpp:244
struct FList * next
Next entry.
Definition: tgf.h:231
tfModPrivInit fctInit
init function
Definition: tgf.h:191
float tdble
Floating point type used in TORCS.
Definition: tgf.h:48
char * dispName
Name to display on screen.
Definition: tgf.h:234
char * sopath
path name of file
Definition: tgf.h:210
#define GfOut
Definition: tgf.h:373
tdble x
x coordinate
Definition: tgf.h:131
void(* tfDirfreeUserData)(void *)
Function to call for releasing the user data associated with file entry.
Definition: tgf.h:240
Parameter set handle structure, multiple handles can reference the same parameter set...
Definition: params.cpp:125
int z
Definition: tgf.h:124
int GfParmSetCurStr(void *handle, const char *path, const char *key, const char *val)
Set a string parameter in the parameter set handle based on subsection iteration. ...
Definition: params.cpp:2532
char * GetDataDir(void)
Definition: tgf.cpp:257
void GfInit(void)
Definition: tgf.cpp:138
int magic
magic number for integrity check
Definition: tgf.h:195
Forces and moments.
Definition: tgf.h:150
void SetDataDir(char *buf)
Definition: tgf.cpp:263
tdble y
y coordinate
Definition: tgf.h:117
int GfModUnloadList(tModList **modlist)
Unload the DLLs of a list.
Definition: module.cpp:91
int GfModFreeInfoList(tModList **modlist)
Free the info contained in the specified list.
Definition: module.cpp:145
tdble z
z coordinate
Definition: tgf.h:118
6 DOF position.
Definition: tgf.h:130
const void * GfHashRemStr(void *hash, char *key)
Remove an element with a string key from a hash table.
Definition: hash.cpp:219
void * handle
handle of loaded module
Definition: tgf.h:208
Definition: tgf.h:121
void GfDirFreeList(tFList *list, tfDirfreeUserData freeUserDatabool, bool freename=false, bool freedispname=false)
Free a directory list.
Definition: directory.cpp:76
void GfParmClean(void *handle)
Clean all the parameters of a parameter set.
Definition: params.cpp:1741
void SetLocalDir(char *buf)
Definition: tgf.cpp:237
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
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
Scalar min(Scalar x, Scalar y)
Definition: Basic.h:49
int GfParmSetCurNum(void *handle, const char *path, const char *key, const char *unit, tdble val)
Set a numerical parameter in the parameter set handle based on subsection iteration.
Definition: params.cpp:2679
int GfParmListClean(void *handle, const char *path)
Remove all the subsections in a section in the parameter set handle.
Definition: params.cpp:2221
struct FList * prev
Previous entry.
Definition: tgf.h:232
char * name
name of the module (short) (NULL if no module)
Definition: tgf.h:189
int index
index if multiple interface in one dll
Definition: tgf.h:193
int GetSingleTextureMode(void)
Definition: tgf.cpp:273
int GfHashAddStr(void *hash, const char *key, const void *data)
Add an element with a string key to a hash table.
Definition: hash.cpp:170
void gfMeanReset(tdble v, tMeanVal *pvt)
Definition: tgf.cpp:147
tdble az
angle along z axis
Definition: tgf.h:136
tPosd vel
velocity
Definition: tgf.h:145
double GfTimeClock(void)
Get the time in seconds.
Definition: os.cpp:50
int GfParmGetEltNb(void *handle, const char *path)
Count the number of subsections in a section in the parameter set handle.
Definition: params.cpp:2106
char * GfParmGetFileName(void *handle)
Get the filename property of the parameter set handle.
Definition: params.cpp:2082
int(* tfModInfo)(tModInfo *)
Definition: tgf.h:200
char * name
File name.
Definition: tgf.h:233
3D point.
Definition: tgf.h:115
int GfModLoadDir(unsigned int gfid, char *dir, tModList **modlist)
Load the DLLs in the specified directory.
Definition: module.cpp:75
tdble ax
angle along x axis
Definition: tgf.h:134
char * desc
description of the module (can be long)
Definition: tgf.h:190
Dynamic point structure.
Definition: tgf.h:142
list of module interfaces
Definition: tgf.h:203
struct ModInfo tModInfo
Module information structure.
const char * GfParmGetCurStr(void *handle, const char *path, const char *key, const char *deflt)
Get a string parameter from the parameter set handle based on subsection iteration.
Definition: params.cpp:2354
void SetSingleTextureMode(void)
Definition: tgf.cpp:279
char * GfParmGetName(void *handle)
Get the name property of the parameter set handle.
Definition: params.cpp:2057
Module information structure.
Definition: tgf.h:188
tPosd pos
position
Definition: tgf.h:144
tFList * GfDirGetList(const char *dir)
Get the list of files of a given directory.
Definition: directory.cpp:43
tdble x
x coordinate
Definition: tgf.h:116
const tdble G
m/s/s
Definition: tgf.h:70
int GfCreateDirForFile(const char *filenameandpath)
Create directory for given file path recursively, so all missing parent directories are created as we...
Definition: tgf.cpp:364
float x
Definition: tgf.h:107
t3Dd M
Moments.
Definition: tgf.h:153
tdble z
z coordinate
Definition: tgf.h:133