24#include <playerpref.h>
26#include <portability.h>
30#define NO_DRV "--- empty ---"
31#define dllname "human"
95#define _Name info.name
96#define _DispName info.dispname
109 const int BUFSIZE = 1024;
139 snprintf(buf, BUFSIZE,
"%d",
curPlayer->racenumber);
148 snprintf(buf, BUFSIZE,
"%d",
curPlayer->racenumber);
154 snprintf(buf, BUFSIZE,
"%d",
curPlayer->nbpitstops);
181 const int BUFSIZE = 1024;
190 free(curCar->_DispName);
194 free(curCat->_DispName);
200 if ((curFile != NULL) && (curFile->
name[0] !=
'.')) {
202 curFile = curFile->
next;
205 char* str = strchr(curFile->
name,
'.');
207 curCat->_Name = strdup(curFile->
name);
208 snprintf(buf, BUFSIZE,
"categories/%s.xml", curFile->
name);
216 }
while (curFile != files);
222 if ((curFile != NULL) && (curFile->
name[0] !=
'.')) {
224 curFile = curFile->
next;
226 curCar->_Name = strdup(curFile->
name);
227 snprintf(buf, BUFSIZE,
"cars/%s/%s.xml", curFile->
name, curFile->
name);
237 if (curCat != NULL) {
239 if (strcmp(curCat->_Name, str) == 0) {
244 curCar->
cat = curCat;
247 }
while (curFile != files);
257 if (curCar == NULL) {
258 GfOut(
"Removing empty category %s\n", tmpCat->_DispName);
261 free(tmpCat->_DispName);
264 }
while (curCat != NULL);
279 for (i = 0; i <
NB_DRV; i++) {
309 const int SSTRINGSIZE = 256;
310 char sstring[SSTRINGSIZE];
318 const int BUFSIZE = 1024;
323 if (drvinfo == NULL) {
327 for (i = 0; i <
NB_DRV; i++) {
330 if (strlen(driver) == 0) {
358 if (strcmp(car->_Name, str) == 0) {
362 }
while (!found && ((car =
GF_TAILQ_NEXT(car, link)) != NULL));
364 }
while (!found && ((cat =
GF_TAILQ_NEXT(cat, link)) != NULL));
381 for (i = 0; i <
NB_DRV; i++) {
408 const int BUFSIZE = 1024;
413 if (drvinfo == NULL) {
417 for (i = 0; i <
NB_DRV; i++) {
437 for (i = 0; i <
NB_DRV; i++) {
475 const int BUFSIZE = 1024;
480 curPlayer->racenumber = (int)strtol(val, (
char **)NULL, 0);
481 snprintf(buf, BUFSIZE,
"%d",
curPlayer->racenumber);
490 const int BUFSIZE = 1024;
495 curPlayer->nbpitstops = (int)strtol(val, (
char **)NULL, 0);
496 snprintf(buf, BUFSIZE,
"%d",
curPlayer->nbpitstops);
545 }
while (car == NULL);
553 }
while (car == NULL);
616 int x,
y, x2, x3, x4, dy;
617 static int firstTime = 1;
672 "data/img/arrow-left.png",
"data/img/arrow-left-pushed.png",
677 "data/img/arrow-right.png",
"data/img/arrow-right-pushed.png",
687 "data/img/arrow-left.png",
"data/img/arrow-left-pushed.png",
692 "data/img/arrow-right.png",
"data/img/arrow-right-pushed.png",
706 "data/img/arrow-left.png",
"data/img/arrow-left-pushed.png",
711 "data/img/arrow-right.png",
"data/img/arrow-right-pushed.png",
725 "data/img/arrow-left.png",
"data/img/arrow-left-pushed.png",
730 "data/img/arrow-right.png",
"data/img/arrow-right-pushed.png",
740 "data/img/arrow-left.png",
"data/img/arrow-left-pushed.png",
745 "data/img/arrow-right.png",
"data/img/arrow-right-pushed.png",
void * TorcsControlMenuInit(void *prevMenu, int idx)
static void SaveDrvList(void *)
static void ChangeReverse(int delta)
static void onSelect(void *)
static void ConfControls(void *)
void * TorcsDriverMenuInit(void *prevMenu)
static void UpdtScrollList(void)
static void DeletePlayer(void *)
static void ChangeCat(int delta)
static void refreshEditVal(void)
static tPlayerInfo PlayersInfo[NB_DRV]
static void ChangePits(void *)
static const char * level_str[]
static void GenCarsInfo(void)
static tCatsInfoHead CatsInfoList
static void ChangeCar(int delta)
static tPlayerInfo * curPlayer
static void ChangeTrans(void *)
static void ChangeName(void *)
static const int nbLevels
static int GenDrvList(void)
static void ChangeLevel(int delta)
static void ChangeNum(void *)
struct PlayerInfo tPlayerInfo
static float LabelColor[]
float tdble
Floating point type used in TORCS.
void GfDirFreeList(tFList *list, tfDirfreeUserData freeUserData, bool freename, bool freedispname)
Free a directory list.
tFList * GfDirGetList(const char *dir)
Get the list of files of a given directory.
void GfuiLabelSetText(void *scr, int id, const char *text)
Change the text of a label.
int GfuiFontHeight(int font)
Get the height of an initialized GUI font.
void GfuiScreenRelease(void *scr)
Release the given screen.
int GfuiScrollListCreateAction(void *scr, int font, int x, int y, int align, int width, int height, int scrollBarPos, const tGfuiAction &onSelect)
Create a new scroll list.
int GfuiTitleCreate(void *scr, const char *text, int maxlen)
Add a Title to the screen.
void GfuiAddKeyAction(void *scr, unsigned char key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
Add a Keyboard callback to a screen.
void GfuiScreenAddBgImg(void *scr, const char *filename)
Add an image background to a screen.
int GfuiEditboxCreateAction(void *scr, const char *text, int font, int x, int y, int width, int maxlen, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost, int margin)
Add an edit box to a screen.
int GfuiScrollListInsertElement(void *scr, int Id, char *element, int index, void *userData)
Insert an element in a scroll list.
void GfuiAddSKeyAction(void *scr, int key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
Add a Special Keyboard shortcut to the screen.
char * GfuiScrollListExtractElement(void *scr, int Id, int index, void **userData)
Extract the specified element from the scroll list.
int GfuiEnable(void *scr, int id, int flag)
Enable / Disable an object.
void GfuiEditboxSetString(void *scr, int id, const char *text)
Set a new string.
char * GfuiScrollListGetSelectedElement(void *scr, int Id, void **userData)
Get the selected element from the scroll list.
char * GfuiEditboxGetString(void *scr, int id)
Get the current text of an edit box.
int GfuiLabelCreate(void *scr, const char *text, int font, int x, int y, int align, int maxlen)
Add a label to a screen.
void GfuiLabelSetColor(void *scr, int id, float *color)
Change the color of a label.
int GfuiGrButtonCreateAction(void *scr, const char *disabled, const char *enabled, const char *focused, const char *pushed, int x, int y, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
Add a graphical button to a screen.
void * GfuiScreenCreate(void)
Create a new screen.
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
int GfuiButtonCreateAction(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
Add a button to a screen.
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 GfParmWriteFile(const char *file, void *parmHandle, const char *name)
Write parameter set into file.
void * GfParmReadFile(const char *file, int mode)
Read parameter set from file and return handle to parameter set.
void GfuiScreenShot(void *)
Save a screen shot in png format.
#define GF_TAILQ_INSERT_TAIL(head, elm, field)
Insert an element at the tail.
#define GF_TAILQ_LAST(head, headname)
Last element of a TAILQ.
#define GF_TAILQ_INIT(head)
Head initialization (Mandatory)
#define GF_TAILQ_HEAD(name, type)
Head type definition.
#define GF_TAILQ_PREV(elm, headname, field)
Previous element of a TAILQ.
#define GF_TAILQ_NEXT(elm, field)
Next element of a TAILQ.
#define GF_TAILQ_REMOVE(head, elm, field)
Remove an element.
#define GF_TAILQ_FIRST(head)
First element of a TAILQ.
#define HM_ATT_AUTOREVERSE
struct FList * next
Next entry.
const char * transmission
GF_TAILQ_ENTRY(struct tCarInfo) link
tCarsInfoHead CarsInfoList
GF_TAILQ_ENTRY(struct tCatInfo) link
#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.
#define GFPARM_RMODE_REREAD
Clear shared cached data and reread the file.
struct FList tFList
List of (DLL) files for a Directory.
#define GFUI_FONT_MEDIUM_C
std::function< void()> tGfuiAction