Re #138 (Task D29 : Selectable livery) Fixed choosen skin not applied after the 1st session in multi-session races (like with prior Qualification)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3044 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 4e09ac4d1f12cdf2e61f8cf8147a8ea2ba4bafcf
Former-commit-id: cc12e126ff0c0b8aff3b4d573c5a92a023ede7c8
This commit is contained in:
pouillot 2010-10-23 17:24:52 +00:00
parent ec48b1a82f
commit 3b4e85dc2c
3 changed files with 154 additions and 105 deletions

View file

@ -639,12 +639,11 @@ static tCarElt* reLoadSingleCar( int carindex, int listindex, int modindex, int
strncpy(elt->_carName, GfParmGetStr(ReInfo->params, path2, RM_ATTR_CARNAME, ""), MAX_NAME_LEN - 1);
elt->_carName[MAX_NAME_LEN - 1] = 0; /* XML file name */
// Load custom car skin name and targets from race info (if specified).
// Load custom skin name and targets from race info (if specified).
snprintf(path2, sizeof(path2), "%s/%d", RM_SECT_DRIVERS_RACING, listindex);
const char* pszSkinName = GfParmGetStr(ReInfo->params, path2, RM_ATTR_SKINNAME, "");
if (strlen(pszSkinName) > 0)
if (GfParmGetStr(ReInfo->params, path2, RM_ATTR_SKINNAME, 0))
{
strncpy(elt->_skinName, pszSkinName, MAX_NAME_LEN - 1);
strncpy(elt->_skinName, GfParmGetStr(ReInfo->params, path2, RM_ATTR_SKINNAME, ""), MAX_NAME_LEN - 1);
elt->_skinName[MAX_NAME_LEN - 1] = 0; // Texture name
}
elt->_skinTargets = (int)GfParmGetNum(ReInfo->params, path2, RM_ATTR_SKINTARGETS, (char*)NULL, 0);
@ -670,8 +669,8 @@ static tCarElt* reLoadSingleCar( int carindex, int listindex, int modindex, int
elt->_endRaceMemPool = NULL;
elt->_shutdownMemPool = NULL;
GfLogTrace("Driver #%d : module='%s', name='%s', car='%s', cat='%s', skin='%s' on %x\n",
carindex, elt->_modName, elt->_name, elt->_carName,
GfLogTrace("Driver #%d(%d) : module='%s', name='%s', car='%s', cat='%s', skin='%s' on %x\n",
carindex, listindex, elt->_modName, elt->_name, elt->_carName,
elt->_category, elt->_skinName, elt->_skinTargets);
/* Retrieve and load car specs : merge car default specs,
@ -687,18 +686,20 @@ static tCarElt* reLoadSingleCar( int carindex, int listindex, int modindex, int
/* Read Car Category specifications */
cathdle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
if (GfParmCheckHandle(cathdle, carhdle)) {
GfLogError("Car %s NOT in Category %s (driver %s) !!!\n", elt->_carName, category, elt->_name);
GfLogError("Car %s NOT in category %s (driver %s) !!!\n", elt->_carName, category, elt->_name);
return NULL;
}
carhdle = GfParmMergeHandles(cathdle, carhdle,
GFPARM_MMODE_SRC | GFPARM_MMODE_DST | GFPARM_MMODE_RELSRC | GFPARM_MMODE_RELDST);
/* The code below stores the carnames to a separate xml-file such that at newTrack it is known which car is used.
* TODO: find a better method for this */
/* The code below stores the carnames to a separate xml-file
such that at newTrack it is known which car is used.
TODO: find a better method for this */
sprintf (buf, "%sdrivers/curcarnames.xml", GetLocalDir());
handle = GfParmReadFile(buf, GFPARM_RMODE_CREAT);
if (handle) {
sprintf (path, "drivers/%s/%d", cardllname, elt->_driverIndex);
GfParmSetStr (handle, path, "car name", elt->_carName);
GfParmSetStr (handle, path, RM_ATTR_CARNAME, elt->_carName);
GfParmWriteFile (0, handle, "Car names");
GfParmReleaseHandle (handle);
}

View file

@ -22,11 +22,11 @@
@author <a href=mailto:eric.espie@torcs.org>Eric Espie</a>
@version $Id$
*/
#include <network.h>
#include <portability.h>
#include <tgfclient.h>
#include <robot.h>
#include <racescreens.h>
#include <network.h>
#include "racesituation.h"
#include "racecareer.h"
@ -43,11 +43,6 @@
#include "racemain.h"
static char buf[1024];
static char path[1024];
static char path2[1024];
//Utility
/**
@ -218,6 +213,7 @@ ReRaceEventInit(void)
int
RePreRace(void)
{
char path[64];
tdble dist;
const char *raceName;
const char *raceType;
@ -294,7 +290,7 @@ RePreRace(void)
ReInfo->s->_raceState = 0;
/* Cleanup results */
sprintf(path, "%s/%s/%s", ReInfo->track->name, RE_SECT_RESULTS, raceName);
snprintf(path, sizeof(path), "%s/%s/%s", ReInfo->track->name, RE_SECT_RESULTS, raceName);
GfParmListClean(results, path);
return RM_SYNC | RM_NEXT_STEP;
@ -309,7 +305,8 @@ reRaceRealStart(void)
tRobotItf *robot;
tReCarInfo *carInfo;
const char *dllname;
char key[256];
char path[256];
char buf[128];
int foundHuman;
void *params = ReInfo->params;
void *results = ReInfo->results;
@ -319,10 +316,10 @@ reRaceRealStart(void)
//Load simulation engine
dllname = GfParmGetStr(ReInfo->_reParam, "Modules", "simu", "");
sprintf(buf, "Loading simulation engine (%s) ...", dllname);
snprintf(buf, sizeof(buf), "Loading simulation engine (%s) ...", dllname);
RmLoadingScreenSetText(buf);
sprintf(key, "%smodules/simu/%s.%s", GetLibDir (), dllname, DLLEXT);
if (GfModLoad(0, key, &ReRaceModList))
snprintf(path, sizeof(path), "%smodules/simu/%s.%s", GetLibDir (), dllname, DLLEXT);
if (GfModLoad(0, path, &ReRaceModList))
return RM_QUIT;
ReRaceModList->modInfo->fctInit(ReRaceModList->modInfo->index, &ReInfo->_reSimItf);
@ -378,9 +375,11 @@ reRaceRealStart(void)
//Load drivers for the race
for (i = 0; i < s->_ncars; i++) {
sprintf(buf, "cars/%s/%s.xml", s->cars[i]->_carName, s->cars[i]->_carName);
snprintf(buf, sizeof(buf), "cars/%s/%s.xml",
s->cars[i]->_carName, s->cars[i]->_carName);
carHdle = GfParmReadFile(buf, GFPARM_RMODE_STD);
sprintf(buf, "Loading driver %s (%s) ...", s->cars[i]->_name, GfParmGetName(carHdle));
snprintf(buf, sizeof(buf), "Loading driver %s (%s) ...",
s->cars[i]->_name, GfParmGetName(carHdle));
RmLoadingScreenSetText(buf);
if (ReInfo->_displayMode != RM_DISP_MODE_SIMU_SIMU) { //Tell robots they are to start a new race
robot = s->cars[i]->robot;
@ -393,7 +392,8 @@ reRaceRealStart(void)
RtTeamManagerStart();
/* Initialize graphical module */
if (ReInfo->_displayMode == RM_DISP_MODE_NORMAL || ReInfo->_displayMode == RM_DISP_MODE_CAPTURE)
if (ReInfo->_displayMode == RM_DISP_MODE_NORMAL
|| ReInfo->_displayMode == RM_DISP_MODE_CAPTURE)
ReInitGraphics();
ReInfo->_reSimItf.update(s, RCM_MAX_DT_SIMU, -1);
@ -417,7 +417,7 @@ reRaceRealStart(void)
} else if (ReInfo->s->_raceType == RM_TYPE_PRACTICE && s->_ncars > 1) {
ReUpdatePracticeCurRes(s->cars[0]);
} else {
sprintf(buf, "%s on %s", s->cars[0]->_name, ReInfo->track->name);
snprintf(buf, 128, "%s on %s", s->cars[0]->_name, ReInfo->track->name);
ReResScreenSetTitle(buf);
}
}//if displayMode != normal
@ -491,6 +491,8 @@ StartRaceHookInit(void)
int
ReRaceStart(void)
{
char path[128];
char path2[128];
int i;
int nCars;
int maxCars;
@ -538,16 +540,19 @@ ReRaceStart(void)
}
// Propagate competitor drivers info to the real race starting grid
sprintf(path, "%s/%d", RM_SECT_DRIVERS, i);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS_RACING, 1);
GfParmSetStr(params, path2, RM_ATTR_MODULE, GfParmGetStr(params, path, RM_ATTR_MODULE, ""));
GfParmSetNum(params, path2, RM_ATTR_IDX, NULL, GfParmGetNum(params, path, RM_ATTR_IDX, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_EXTENDED, NULL, GfParmGetNum(params, path, RM_ATTR_EXTENDED, NULL, 0));
const int nSkinTgts = (int)GfParmGetNum(params, path, RM_ATTR_SKINTARGETS, NULL, 0);
GfParmSetNum(params, path2, RM_ATTR_SKINTARGETS, NULL, nSkinTgts);
const char* pszSkinName = GfParmGetStr(params, path, RM_ATTR_SKINNAME, "");
if (strlen(pszSkinName) > 0)
GfParmSetStr(params, path2, RM_ATTR_SKINNAME, pszSkinName);
snprintf(path, sizeof(path), "%s/%d", RM_SECT_DRIVERS, i);
snprintf(path2, sizeof(path2), "%s/%d", RM_SECT_DRIVERS_RACING, 1);
GfParmSetStr(params, path2, RM_ATTR_MODULE,
GfParmGetStr(params, path, RM_ATTR_MODULE, ""));
GfParmSetNum(params, path2, RM_ATTR_IDX, NULL,
GfParmGetNum(params, path, RM_ATTR_IDX, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_EXTENDED, NULL,
GfParmGetNum(params, path, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_SKINTARGETS, NULL,
GfParmGetNum(params, path, RM_ATTR_SKINTARGETS, NULL, 0));
if (GfParmGetStr(params, path, RM_ATTR_SKINNAME, 0))
GfParmSetStr(params, path2, RM_ATTR_SKINNAME,
GfParmGetStr(params, path, RM_ATTR_SKINNAME, ""));
}
else
{
@ -556,10 +561,11 @@ ReRaceStart(void)
gridType = GfParmGetStr(params, raceName, RM_ATTR_START_ORDER, RM_VAL_DRV_LIST_ORDER);
// Starting grid in the arrival order of the previous race
// Starting grid in the arrival order of the previous race (or qualification session)
if (!strcmp(gridType, RM_VAL_LAST_RACE_ORDER))
{
GfLogInfo("Starting %s : Starting grid in the order of the last race\n", ReInfo->_reName);
GfLogInfo("Starting %s : Starting grid in the order of the last race\n",
ReInfo->_reName);
nCars = GfParmGetEltNb(params, RM_SECT_DRIVERS);
maxCars = (int)GfParmGetNum(params, raceName, RM_ATTR_MAX_DRV, NULL, 100);
@ -569,16 +575,20 @@ ReRaceStart(void)
return RM_QUIT;
}
for (i = 1; i < nCars + 1; i++) {
sprintf(path, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, prevRaceName, RE_SECT_RANK, i);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS_RACING, i);
GfParmSetStr(params, path2, RM_ATTR_MODULE, GfParmGetStr(results, path, RE_ATTR_MODULE, ""));
GfParmSetNum(params, path2, RM_ATTR_IDX, NULL, GfParmGetNum(results, path, RE_ATTR_IDX, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_EXTENDED, NULL, GfParmGetNum(results, path, RM_ATTR_EXTENDED, NULL, 0));
const int nSkinTgts = (int)GfParmGetNum(results, path, RM_ATTR_SKINTARGETS, (char*)NULL, 0);
GfParmSetNum(params, path2, RM_ATTR_SKINTARGETS, NULL, nSkinTgts);
const char* pszSkinName = GfParmGetStr(results, path, RM_ATTR_SKINNAME, "");
if (strlen(pszSkinName) > 0)
GfParmSetStr(params, path2, RM_ATTR_SKINNAME, pszSkinName);
snprintf(path, sizeof(path), "%s/%s/%s/%s/%d",
ReInfo->track->name, RE_SECT_RESULTS, prevRaceName, RE_SECT_RANK, i);
snprintf(path2, sizeof(path2), "%s/%d", RM_SECT_DRIVERS_RACING, i);
GfParmSetStr(params, path2, RM_ATTR_MODULE,
GfParmGetStr(results, path, RE_ATTR_MODULE, ""));
GfParmSetNum(params, path2, RM_ATTR_IDX, NULL,
GfParmGetNum(results, path, RE_ATTR_IDX, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_EXTENDED, NULL,
GfParmGetNum(results, path, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_SKINTARGETS, NULL,
GfParmGetNum(results, path, RM_ATTR_SKINTARGETS, NULL, 0));
if (GfParmGetStr(results, path, RM_ATTR_SKINNAME, 0))
GfParmSetStr(params, path2, RM_ATTR_SKINNAME,
GfParmGetStr(results, path, RM_ATTR_SKINNAME, ""));
}
}
@ -595,16 +605,20 @@ ReRaceStart(void)
return RM_QUIT;
}
for (i = 1; i < nCars + 1; i++) {
sprintf(path, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, prevRaceName, RE_SECT_RANK, nCars - i + 1);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS_RACING, i);
GfParmSetStr(params, path2, RM_ATTR_MODULE, GfParmGetStr(results, path, RE_ATTR_MODULE, ""));
GfParmSetNum(params, path2, RM_ATTR_IDX, NULL, GfParmGetNum(results, path, RE_ATTR_IDX, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_EXTENDED, NULL, GfParmGetNum(results, path, RM_ATTR_EXTENDED, NULL, 0));
const int nSkinTgts = (int)GfParmGetNum(results, path, RM_ATTR_SKINTARGETS, (char*)NULL, 0);
GfParmSetNum(params, path2, RM_ATTR_SKINTARGETS, NULL, nSkinTgts);
const char* pszSkinName = GfParmGetStr(results, path, RM_ATTR_SKINNAME, 0);
if (pszSkinName && strlen(pszSkinName) > 0)
GfParmSetStr(params, path2, RM_ATTR_SKINNAME, pszSkinName);
snprintf(path, sizeof(path), "%s/%s/%s/%s/%d",
ReInfo->track->name, RE_SECT_RESULTS, prevRaceName, RE_SECT_RANK, nCars - i + 1);
snprintf(path2, sizeof(path2), "%s/%d", RM_SECT_DRIVERS_RACING, i);
GfParmSetStr(params, path2, RM_ATTR_MODULE,
GfParmGetStr(results, path, RE_ATTR_MODULE, ""));
GfParmSetNum(params, path2, RM_ATTR_IDX, NULL,
GfParmGetNum(results, path, RE_ATTR_IDX, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_EXTENDED, NULL,
GfParmGetNum(results, path, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_SKINTARGETS, NULL,
GfParmGetNum(results, path, RM_ATTR_SKINTARGETS, NULL, 0));
if (GfParmGetStr(results, path, RM_ATTR_SKINNAME, 0))
GfParmSetStr(params, path2, RM_ATTR_SKINNAME,
GfParmGetStr(results, path, RM_ATTR_SKINNAME, ""));
}
}
@ -617,16 +631,19 @@ ReRaceStart(void)
maxCars = (int)GfParmGetNum(params, raceName, RM_ATTR_MAX_DRV, NULL, 100);
nCars = MIN(nCars, maxCars);
for (i = 1; i < nCars + 1; i++) {
sprintf(path, "%s/%d", RM_SECT_DRIVERS, i);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS_RACING, i);
GfParmSetStr(params, path2, RM_ATTR_MODULE, GfParmGetStr(params, path, RM_ATTR_MODULE, ""));
GfParmSetNum(params, path2, RM_ATTR_IDX, NULL, GfParmGetNum(params, path, RM_ATTR_IDX, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_EXTENDED, NULL, GfParmGetNum(params, path, RM_ATTR_EXTENDED, NULL, 0));
const int nSkinTgts = (int)GfParmGetNum(params, path, RM_ATTR_SKINTARGETS, (char*)NULL, 0);
GfParmSetNum(params, path2, RM_ATTR_SKINTARGETS, NULL, nSkinTgts);
const char* pszSkinName = GfParmGetStr(params, path, RM_ATTR_SKINNAME, 0);
if (pszSkinName && strlen(pszSkinName) > 0)
GfParmSetStr(params, path2, RM_ATTR_SKINNAME, pszSkinName);
snprintf(path, sizeof(path), "%s/%d", RM_SECT_DRIVERS, i);
snprintf(path2, sizeof(path2), "%s/%d", RM_SECT_DRIVERS_RACING, i);
GfParmSetStr(params, path2, RM_ATTR_MODULE,
GfParmGetStr(params, path, RM_ATTR_MODULE, ""));
GfParmSetNum(params, path2, RM_ATTR_IDX, NULL,
GfParmGetNum(params, path, RM_ATTR_IDX, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_EXTENDED, NULL,
GfParmGetNum(params, path, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetNum(params, path2, RM_ATTR_SKINTARGETS, NULL,
GfParmGetNum(results, path, RM_ATTR_SKINTARGETS, NULL, 0));
if (GfParmGetStr(results, path, RM_ATTR_SKINNAME, 0))
GfParmSetStr(params, path2, RM_ATTR_SKINNAME,
GfParmGetStr(results, path, RM_ATTR_SKINNAME, ""));
}
}
}
@ -835,6 +852,7 @@ RePostRace(void)
int
ReEventShutdown(void)
{
char buf[64];
int curTrkIdx;
void *params = ReInfo->params;
int nbTrk;
@ -899,7 +917,8 @@ ReEventShutdown(void)
}
/* Check if it is free */
snprintf( buf, 1024, "%s/%d", RM_SECT_TRACKS, (int)GfParmGetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_TRACK, NULL, 1) );
snprintf( buf, sizeof(buf), "%s/%d", RM_SECT_TRACKS,
(int)GfParmGetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_TRACK, NULL, 1) );
if( !strcmp(GfParmGetStr(params, buf, RM_ATTR_NAME, "free"), "free") == 0) {
/* Not a free weekend */
GfParmReleaseHandle( results );

View file

@ -95,12 +95,17 @@ ReEventInitResults(void)
{
sprintf(path, "%s/%s/%d", ReInfo->track->name, RM_SECT_DRIVERS, i);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS, i);
GfParmSetStr(results, path, RE_ATTR_DLL_NAME, GfParmGetStr(params, path2, RM_ATTR_MODULE, ""));
GfParmSetNum(results, path, RE_ATTR_INDEX, NULL, GfParmGetNum(params, path2, RM_ATTR_IDX, (char*)NULL, 0));
GfParmSetNum(results, path, RM_ATTR_EXTENDED, NULL, GfParmGetNum(params, path2, RM_ATTR_EXTENDED, (char*)NULL, 0));
//GfParmSetStr(results, path, ROB_ATTR_NAME, GfParmGetStr(params, path2, ROB_ATTR_NAME, ""));
//GfParmSetStr(results, path, ROB_ATTR_CAR, GfParmGetStr(params, path2, ROB_ATTR_CAR, ""));
}
GfParmSetStr(results, path, RE_ATTR_DLL_NAME,
GfParmGetStr(params, path2, RM_ATTR_MODULE, ""));
GfParmSetNum(results, path, RE_ATTR_INDEX, NULL,
GfParmGetNum(params, path2, RM_ATTR_IDX, (char*)NULL, 0));
GfParmSetNum(results, path, RM_ATTR_EXTENDED, NULL,
GfParmGetNum(params, path2, RM_ATTR_EXTENDED, (char*)NULL, 0));
//GfParmSetStr(results, path, ROB_ATTR_NAME,
// GfParmGetStr(params, path2, ROB_ATTR_NAME, ""));
//GfParmSetStr(results, path, ROB_ATTR_CAR,
// GfParmGetStr(params, path2, ROB_ATTR_CAR, ""));
}
}
@ -263,7 +268,8 @@ ReStoreRaceResults(const char *race)
for (i = 0; i < s->_ncars; i++) {
sprintf(path, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i + 1);
car = s->cars[i];
if (car->_laps > s->_totLaps) car->_laps = s->_totLaps + 1;
if (car->_laps > s->_totLaps)
car->_laps = s->_totLaps + 1;
GfParmSetStr(results, path, RE_ATTR_NAME, car->_name);
@ -282,14 +288,17 @@ ReStoreRaceResults(const char *race)
GfParmSetNum(results, path, RE_ATTR_NB_PIT_STOPS, NULL, car->_nbPitStops);
GfParmSetStr(results, path, RE_ATTR_MODULE, car->_modName);
GfParmSetNum(results, path, RE_ATTR_IDX, NULL, car->_moduleIndex);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS_RACING, car->index + 1 );
GfParmSetNum(results, path, RM_ATTR_EXTENDED, NULL, GfParmGetNum(params, path2, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetStr(results, path, ROB_ATTR_CAR, car->_carName);
GfParmSetNum(results, path, RE_ATTR_IDX, NULL, car->_moduleIndex);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS_RACING, car->index + 1 );
GfParmSetNum(results, path, RM_ATTR_EXTENDED, NULL,
GfParmGetNum(params, path2, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetStr(results, path, ROB_ATTR_CAR, car->_carName);
sprintf(path2, "%s/%s/%d", race, RM_SECT_POINTS, i + 1);
GfParmSetNum(results, path, RE_ATTR_POINTS, NULL,
(int)GfParmGetNum(params, path2, RE_ATTR_POINTS, NULL, 0));
(int)GfParmGetNum(params, path2, RE_ATTR_POINTS, NULL, 0));
if (strlen(car->_skinName) > 0)
GfParmSetStr(results, path, RM_ATTR_SKINNAME, car->_skinName);
GfParmSetNum(results, path, RM_ATTR_SKINTARGETS, NULL, car->_skinTargets);
GfParmReleaseHandle(carparam);
}
@ -315,23 +324,36 @@ ReStoreRaceResults(const char *race)
sprintf(path, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i);
float opponentBestLapTime = GfParmGetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, 0);
if (
(car->_bestLapTime != 0.0) &&
((car->_bestLapTime < opponentBestLapTime) || (opponentBestLapTime == 0.0))
) {
if (car->_bestLapTime != 0.0
&& (car->_bestLapTime < opponentBestLapTime || opponentBestLapTime == 0.0))
{
/* shift */
sprintf(path2, "%s/%s/%s/%s/%d", ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i + 1);
GfParmSetStr(results, path2, RE_ATTR_NAME, GfParmGetStr(results, path, RE_ATTR_NAME, ""));
GfParmSetStr(results, path2, RE_ATTR_CAR, GfParmGetStr(results, path, RE_ATTR_CAR, ""));
GfParmSetNum(results, path2, RE_ATTR_BEST_LAP_TIME, NULL, GfParmGetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, 0));
GfParmSetStr(results, path2, RE_ATTR_MODULE, GfParmGetStr(results, path, RM_ATTR_MODULE, ""));
GfParmSetNum(results, path2, RE_ATTR_IDX, NULL, GfParmGetNum(results, path, RM_ATTR_IDX, NULL, 0));
GfParmSetNum(results, path2, RM_ATTR_EXTENDED, NULL, GfParmGetNum(results, path, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetStr(results, path2, ROB_ATTR_CAR, GfParmGetStr(results, path, ROB_ATTR_CAR, ""));
GfParmSetStr(results, path2, ROB_ATTR_NAME, GfParmGetStr(results, path, ROB_ATTR_NAME, ""));
sprintf(path2, "%s/%s/%s/%s/%d",
ReInfo->track->name, RE_SECT_RESULTS, race, RE_SECT_RANK, i + 1);
GfParmSetStr(results, path2, RE_ATTR_NAME,
GfParmGetStr(results, path, RE_ATTR_NAME, ""));
GfParmSetStr(results, path2, RE_ATTR_CAR,
GfParmGetStr(results, path, RE_ATTR_CAR, ""));
GfParmSetNum(results, path2, RE_ATTR_BEST_LAP_TIME, NULL,
GfParmGetNum(results, path, RE_ATTR_BEST_LAP_TIME, NULL, 0));
GfParmSetStr(results, path2, RE_ATTR_MODULE,
GfParmGetStr(results, path, RM_ATTR_MODULE, ""));
GfParmSetNum(results, path2, RE_ATTR_IDX, NULL,
GfParmGetNum(results, path, RM_ATTR_IDX, NULL, 0));
GfParmSetNum(results, path2, RM_ATTR_EXTENDED, NULL,
GfParmGetNum(results, path, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetStr(results, path2, ROB_ATTR_CAR,
GfParmGetStr(results, path, ROB_ATTR_CAR, ""));
GfParmSetStr(results, path2, ROB_ATTR_NAME,
GfParmGetStr(results, path, ROB_ATTR_NAME, ""));
sprintf(path, "%s/%s/%d", race, RM_SECT_POINTS, i + 1);
GfParmSetNum(results, path2, RE_ATTR_POINTS, NULL,
(int)GfParmGetNum(params, path, RE_ATTR_POINTS, NULL, 0));
(int)GfParmGetNum(params, path, RE_ATTR_POINTS, NULL, 0));
if (GfParmGetStr(results, path, RM_ATTR_SKINNAME, 0))
GfParmSetStr(results, path2, RM_ATTR_SKINNAME,
GfParmGetStr(results, path, RM_ATTR_SKINNAME, 0));
GfParmSetNum(results, path2, RM_ATTR_SKINTARGETS, NULL,
GfParmGetNum(results, path, RM_ATTR_SKINTARGETS, NULL, 0));
} else {
break;
}
@ -351,10 +373,14 @@ ReStoreRaceResults(const char *race)
GfParmSetStr(results, path, ROB_ATTR_CAR, car->_carName);
GfParmSetStr(results, path, ROB_ATTR_NAME, car->_name);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS_RACING, car->index + 1 );
GfParmSetNum(results, path, RM_ATTR_EXTENDED, NULL, GfParmGetNum(params, path2, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetNum(results, path, RM_ATTR_EXTENDED, NULL,
GfParmGetNum(params, path2, RM_ATTR_EXTENDED, NULL, 0));
sprintf(path2, "%s/%s/%d", race, RM_SECT_POINTS, i + 1);
GfParmSetNum(results, path, RE_ATTR_POINTS, NULL,
(int)GfParmGetNum(params, path2, RE_ATTR_POINTS, NULL, 0));
(int)GfParmGetNum(params, path2, RE_ATTR_POINTS, NULL, 0));
if (strlen(car->_skinName) > 0)
GfParmSetStr(results, path, RM_ATTR_SKINNAME, car->_skinName);
GfParmSetNum(results, path, RM_ATTR_SKINTARGETS, NULL, car->_skinTargets);
GfParmReleaseHandle(carparam);
break;
@ -362,7 +388,7 @@ ReStoreRaceResults(const char *race)
car = s->cars[0];
if (s->_totTime < 0.0f)
GfOut( "WARNING: saving result of multicar non-race session, but it was not timed!\n" );
GfLogWarning("Saving results of multicar non-race session, but it was not timed!\n" );
sprintf(path, "%s/%s/%s", ReInfo->track->name, RE_SECT_RESULTS, race);
GfParmListClean(results, path);
GfParmSetNum(results, path, RE_ATTR_SESSIONTIME, NULL, s->_totTime);
@ -388,15 +414,18 @@ ReStoreRaceResults(const char *race)
GfParmSetNum(results, path, RE_ATTR_NB_PIT_STOPS, NULL, car->_nbPitStops);
GfParmSetStr(results, path, RE_ATTR_MODULE, car->_modName);
GfParmSetNum(results, path, RE_ATTR_IDX, NULL, car->_moduleIndex);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS_RACING, car->index + 1 );
GfParmSetNum(results, path, RM_ATTR_EXTENDED, NULL, GfParmGetNum(params, path2, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetStr(results, path, ROB_ATTR_CAR, car->_carName);
GfParmSetNum(results, path, RE_ATTR_IDX, NULL, car->_moduleIndex);
sprintf(path2, "%s/%d", RM_SECT_DRIVERS_RACING, car->index + 1 );
GfParmSetNum(results, path, RM_ATTR_EXTENDED, NULL,
GfParmGetNum(params, path2, RM_ATTR_EXTENDED, NULL, 0));
GfParmSetStr(results, path, ROB_ATTR_CAR, car->_carName);
sprintf(path2, "%s/%s/%d", race, RM_SECT_POINTS, i + 1);
GfParmSetNum(results, path, RE_ATTR_POINTS, NULL,
(int)GfParmGetNum(params, path2, RE_ATTR_POINTS, NULL, 0));
(int)GfParmGetNum(params, path2, RE_ATTR_POINTS, NULL, 0));
if (strlen(car->_skinName) > 0)
GfParmSetStr(results, path, RM_ATTR_SKINNAME, car->_skinName);
GfParmSetNum(results, path, RM_ATTR_SKINTARGETS, NULL, car->_skinTargets);
GfParmReleaseHandle(carparam);
}
break;