int ReRaceEventInit(void) { void *mainParams = ReInfo->mainParams; void *params = ReInfo->params; const bool careerMode = strcmp(GfParmGetStr(ReInfo->mainParams, RM_SECT_SUBFILES, RM_ATTR_HASSUBFILES, RM_VAL_NO), RM_VAL_YES) == 0; /* Career mode : Look if it is necessary to open another file */ if (strcmp(GfParmGetStr(mainParams, RM_SECT_SUBFILES, RM_ATTR_HASSUBFILES, RM_VAL_NO), RM_VAL_YES) == 0) { /* Close previous params */ if (params != mainParams) GfParmReleaseHandle(params); /* Read the new params */ ReInfo->params = GfParmReadFile( GfParmGetStr( ReInfo->mainResults, RE_SECT_CURRENT, RE_ATTR_CUR_FILE, "" ), GFPARM_RMODE_STD ); GfLogTrace("Career : New params file is %s (from main results file)\n", GfParmGetStr( ReInfo->mainResults, RE_SECT_CURRENT, RE_ATTR_CUR_FILE, "")); if (!ReInfo->params) GfLogWarning( "Career : MainResults params weren't read correctly\n" ); /* Close previous results */ if (ReInfo->results != ReInfo->mainResults) { GfParmWriteFile(NULL, ReInfo->results, NULL); GfParmReleaseHandle(ReInfo->results); } /* Read the new results */ ReInfo->results = GfParmReadFile( GfParmGetStr( ReInfo->params, RM_SECT_SUBFILES, RM_ATTR_RESULTSUBFILE, ""), GFPARM_RMODE_STD ); if (!ReInfo->results) GfLogWarning( "Career : New results weren't read correctly\n" ); } // Initialize the race session name. ReInfo->_reRaceName = ReGetCurrentRaceName(); GfLogInfo("Starting new event (%s session)\n", ReInfo->_reRaceName); ReUI().onRaceEventInitializing(); ReInfo->s->_features = RmGetFeaturesList(ReInfo->params); ReTrackInit(); ReEventInitResults(); NoCleanupNeeded = false; const bool bGoOnLooping = ReUI().onRaceEventStarting(careerMode && !ReHumanInGroup()); return (bGoOnLooping ? RM_SYNC : RM_ASYNC) | RM_NEXT_STEP; }
int ReRaceEventInit(void) { void *params = ReInfo->params; RmLoadingScreenStart(ReInfo->_reName, "data/img/splash-qrloading.png"); taManager->Init(ReInfo); // Initialize Track if (!taManager->IsActive()) ReInitTrack(); // Initialize Graphics if ( (ReInfo->_displayMode != RM_DISP_MODE_CONSOLE) && (ReInfo->_reGraphicItf.inittrack != 0) ) { RmLoadingScreenSetText("Loading Track 3D Description..."); ReInfo->_reGraphicItf.inittrack(ReInfo->track); }; if (taManager->IsActive()) { RmLoadingScreenSetText("Initializing TORCS Adaptive Manager..."); taManager->InitGraphics(); } ReEventInitResults(); if ( (GfParmGetEltNb(params, RM_SECT_TRACKS) > 1) && (ReInfo->_displayMode != RM_DISP_MODE_NONE) && (ReInfo->_displayMode != RM_DISP_MODE_CONSOLE) ) { ReNewTrackMenu(); return RM_ASYNC | RM_NEXT_STEP; } return RM_SYNC | RM_NEXT_STEP; }