trackv1: move loop count variable into for loop

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

Former-commit-id: d2062570c935aa5cd7bf00a95e723d85d3fa0f2b
Former-commit-id: 999881d9bc3774fba66e99a88ddd0d7b51c6d4fe
This commit is contained in:
iobyte 2022-05-17 00:21:47 +00:00
parent 0becbe2f54
commit d9dfaa0070
4 changed files with 59 additions and 80 deletions

View file

@ -249,7 +249,6 @@ FinishTrackLoading(void* TrackHandle)
double currentDistance; double currentDistance;
double tmpDistance; double tmpDistance;
int currentLength; int currentLength;
int xx;
theTrack->numberOfSectors = GfParmGetEltNb(TrackHandle, TRK_SECT_SECTORS); theTrack->numberOfSectors = GfParmGetEltNb(TrackHandle, TRK_SECT_SECTORS);
@ -281,7 +280,7 @@ FinishTrackLoading(void* TrackHandle)
if (theTrack->numberOfSectors > 0) if (theTrack->numberOfSectors > 0)
{ {
distances = (double*)malloc( sizeof( double ) * theTrack->numberOfSectors ); distances = (double*)malloc( sizeof( double ) * theTrack->numberOfSectors );
for( xx = 0; xx < theTrack->numberOfSectors; ++xx ) for (int xx = 0; xx < theTrack->numberOfSectors; ++xx )
distances[ xx ] = theTrack->length * (double)(xx + 1) / (double)(theTrack->numberOfSectors + 1); distances[ xx ] = theTrack->length * (double)(xx + 1) / (double)(theTrack->numberOfSectors + 1);
} }
} }
@ -297,7 +296,7 @@ FinishTrackLoading(void* TrackHandle)
currentDistance = GfParmGetCurNum( TrackHandle, TRK_SECT_SECTORS, TRK_ATT_SECTOR_DFS, NULL, 0.0f); currentDistance = GfParmGetCurNum( TrackHandle, TRK_SECT_SECTORS, TRK_ATT_SECTOR_DFS, NULL, 0.0f);
if (currentDistance <= 0.0f || currentDistance >= theTrack->length) if (currentDistance <= 0.0f || currentDistance >= theTrack->length)
continue; /* Don't add the startline as sector */ continue; /* Don't add the startline as sector */
for (xx = 0; xx < currentLength; ++xx) for (int xx = 0; xx < currentLength; ++xx)
{ {
if (distances[xx] > currentDistance) if (distances[xx] > currentDistance)
{ {
@ -320,7 +319,7 @@ FinishTrackLoading(void* TrackHandle)
{ {
theTrack->sectors = (double*)malloc( sizeof(double) * theTrack->numberOfSectors ); theTrack->sectors = (double*)malloc( sizeof(double) * theTrack->numberOfSectors );
for( xx = 0; xx < theTrack->numberOfSectors; ++xx ) for (int xx = 0; xx < theTrack->numberOfSectors; ++xx )
theTrack->sectors[xx] = distances[xx]; theTrack->sectors[xx] = distances[xx];
} }
else else
@ -367,7 +366,6 @@ TrackShutdown(void)
tTrackSurface *nextSurf; tTrackSurface *nextSurf;
tRoadCam *curCam; tRoadCam *curCam;
tRoadCam *nextCam; tRoadCam *nextCam;
int xx;
if (!theTrack) { if (!theTrack) {
return; return;
@ -401,7 +399,7 @@ TrackShutdown(void)
free(theTrack->graphic.env); free(theTrack->graphic.env);
if(theTrack->graphic.nb_lights > 0) if(theTrack->graphic.nb_lights > 0)
{ {
for (xx = 0; xx < theTrack->graphic.nb_lights; ++xx) for (int xx = 0; xx < theTrack->graphic.nb_lights; ++xx)
{ {
free(theTrack->graphic.lights[ xx ].onTexture); free(theTrack->graphic.lights[ xx ].onTexture);
free(theTrack->graphic.lights[ xx ].offTexture); free(theTrack->graphic.lights[ xx ].offTexture);

View file

@ -131,10 +131,9 @@ AddTrackSurface(void *TrackHandle, tTrack *theTrack, const char *material)
static void static void
InitSides(void *TrackHandle, tTrack *theTrack) InitSides(void *TrackHandle, tTrack *theTrack)
{ {
int side;
const char *style; const char *style;
for (side = 0; side < 2; side++) { for (int side = 0; side < 2; side++) {
sideMaterial[side] = GfParmGetStr(TrackHandle, TRK_SECT_MAIN, KeySideSurface[side], TRK_VAL_GRASS); sideMaterial[side] = GfParmGetStr(TrackHandle, TRK_SECT_MAIN, KeySideSurface[side], TRK_VAL_GRASS);
sideSurface[side] = AddTrackSurface(TrackHandle, theTrack, sideMaterial[side]); sideSurface[side] = AddTrackSurface(TrackHandle, theTrack, sideMaterial[side]);
sideEndWidth[side] = GfParmGetNum(TrackHandle, TRK_SECT_MAIN, KeySideWidth[side], (char*)NULL, 0.0); sideEndWidth[side] = GfParmGetNum(TrackHandle, TRK_SECT_MAIN, KeySideWidth[side], (char*)NULL, 0.0);
@ -182,13 +181,11 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
tTrackBarrier *curBarrier; tTrackBarrier *curBarrier;
tdble x, y, z; tdble x, y, z;
tdble al, alfl; tdble al, alfl;
int j;
tdble x1, x2, y1, y2; tdble x1, x2, y1, y2;
tdble sw, ew, bw; tdble sw, ew, bw;
tdble minWidth; tdble minWidth;
tdble maxWidth; tdble maxWidth;
int type; int type;
int side;
const char *style; const char *style;
tdble Kew; tdble Kew;
static char path[BUFSIZE]; static char path[BUFSIZE];
@ -197,7 +194,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
mSeg = curSeg; mSeg = curSeg;
snprintf(path, sizeof(path), "%s/%s", TRK_SECT_MAIN, TRK_LST_SEG); snprintf(path, sizeof(path), "%s/%s", TRK_SECT_MAIN, TRK_LST_SEG);
for (side = 0; side < 2; side++) { for (int side = 0; side < 2; side++) {
curSeg = mSeg; curSeg = mSeg;
if (curStep == 0) { if (curStep == 0) {
/* Side parameters */ /* Side parameters */
@ -345,7 +342,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)((curBorder->angle[TR_ZE] - curBorder->angle[TR_ZS])/36.0); al = (tdble)((curBorder->angle[TR_ZE] - curBorder->angle[TR_ZS])/36.0);
alfl = curBorder->angle[TR_ZS]; alfl = curBorder->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curBorder->center.x + (curBorder->radiusl) * sin(alfl); /* location of end */ x1 = curBorder->center.x + (curBorder->radiusl) * sin(alfl); /* location of end */
y1 = curBorder->center.y - (curBorder->radiusl) * cos(alfl); y1 = curBorder->center.y - (curBorder->radiusl) * cos(alfl);
@ -382,7 +379,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)((curBorder->angle[TR_ZE] - curBorder->angle[TR_ZS])/36.0); al = (tdble)((curBorder->angle[TR_ZE] - curBorder->angle[TR_ZS])/36.0);
alfl = curBorder->angle[TR_ZS]; alfl = curBorder->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curBorder->center.x + (curBorder->radiusr) * sin(alfl); /* location of end */ x2 = curBorder->center.x + (curBorder->radiusr) * sin(alfl); /* location of end */
y2 = curBorder->center.y - (curBorder->radiusr) * cos(alfl); y2 = curBorder->center.y - (curBorder->radiusr) * cos(alfl);
@ -426,7 +423,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)((curBorder->angle[TR_ZE] - curBorder->angle[TR_ZS])/36.0); al = (tdble)((curBorder->angle[TR_ZE] - curBorder->angle[TR_ZS])/36.0);
alfl = curBorder->angle[TR_ZS]; alfl = curBorder->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curBorder->center.x - (curBorder->radiusl) * sin(alfl); /* location of end */ x1 = curBorder->center.x - (curBorder->radiusl) * sin(alfl); /* location of end */
y1 = curBorder->center.y + (curBorder->radiusl) * cos(alfl); y1 = curBorder->center.y + (curBorder->radiusl) * cos(alfl);
@ -463,7 +460,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)((curBorder->angle[TR_ZE] - curBorder->angle[TR_ZS])/36.0); al = (tdble)((curBorder->angle[TR_ZE] - curBorder->angle[TR_ZS])/36.0);
alfl = curBorder->angle[TR_ZS]; alfl = curBorder->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curBorder->center.x - (curBorder->radiusr) * sin(alfl); /* location of end */ x2 = curBorder->center.x - (curBorder->radiusr) * sin(alfl); /* location of end */
y2 = curBorder->center.y - (curBorder->radiusr) * cos(alfl); y2 = curBorder->center.y - (curBorder->radiusr) * cos(alfl);
@ -580,7 +577,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)((curSide->angle[TR_ZE] - curSide->angle[TR_ZS])/36.0); al = (tdble)((curSide->angle[TR_ZE] - curSide->angle[TR_ZS])/36.0);
alfl = curSide->angle[TR_ZS]; alfl = curSide->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curSide->center.x + (curSide->radiusl) * sin(alfl); /* location of end */ x1 = curSide->center.x + (curSide->radiusl) * sin(alfl); /* location of end */
y1 = curSide->center.y - (curSide->radiusl) * cos(alfl); y1 = curSide->center.y - (curSide->radiusl) * cos(alfl);
@ -617,7 +614,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)((curSide->angle[TR_ZE] - curSide->angle[TR_ZS])/36.0); al = (tdble)((curSide->angle[TR_ZE] - curSide->angle[TR_ZS])/36.0);
alfl = curSide->angle[TR_ZS]; alfl = curSide->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curSide->center.x + (curSide->radiusr) * sin(alfl); /* location of end */ x2 = curSide->center.x + (curSide->radiusr) * sin(alfl); /* location of end */
y2 = curSide->center.y - (curSide->radiusr) * cos(alfl); y2 = curSide->center.y - (curSide->radiusr) * cos(alfl);
@ -661,7 +658,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)((curSide->angle[TR_ZE] - curSide->angle[TR_ZS])/36.0); al = (tdble)((curSide->angle[TR_ZE] - curSide->angle[TR_ZS])/36.0);
alfl = curSide->angle[TR_ZS]; alfl = curSide->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curSide->center.x - (curSide->radiusl) * sin(alfl); /* location of end */ x1 = curSide->center.x - (curSide->radiusl) * sin(alfl); /* location of end */
y1 = curSide->center.y + (curSide->radiusl) * cos(alfl); y1 = curSide->center.y + (curSide->radiusl) * cos(alfl);
@ -698,7 +695,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)((curSide->angle[TR_ZE] - curSide->angle[TR_ZS])/36.0); al = (tdble)((curSide->angle[TR_ZE] - curSide->angle[TR_ZS])/36.0);
alfl = curSide->angle[TR_ZS]; alfl = curSide->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curSide->center.x - (curSide->radiusr) * sin(alfl); /* location of end */ x2 = curSide->center.x - (curSide->radiusr) * sin(alfl); /* location of end */
y2 = curSide->center.y - (curSide->radiusr) * cos(alfl); y2 = curSide->center.y - (curSide->radiusr) * cos(alfl);
@ -776,7 +773,6 @@ normSeg(tTrackSeg *curSeg)
static void static void
CreateSegRing3(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *end, int ext) CreateSegRing3(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *end, int ext)
{ {
int j;
int segread, curindex; int segread, curindex;
tdble radius, radiusend = 0, dradius; tdble radius, radiusend = 0, dradius;
tdble innerradius; tdble innerradius;
@ -1179,7 +1175,7 @@ CreateSegRing3(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg
al = (tdble)((curSeg->angle[TR_ZE] - curSeg->angle[TR_ZS])/36.0); al = (tdble)((curSeg->angle[TR_ZE] - curSeg->angle[TR_ZS])/36.0);
alfl = curSeg->angle[TR_ZS]; alfl = curSeg->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curSeg->center.x + (innerradius) * sin(alfl); /* location of end */ x1 = curSeg->center.x + (innerradius) * sin(alfl); /* location of end */
y1 = curSeg->center.y - (innerradius) * cos(alfl); y1 = curSeg->center.y - (innerradius) * cos(alfl);
@ -1247,7 +1243,7 @@ CreateSegRing3(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg
al = (tdble)((curSeg->angle[TR_ZE] - curSeg->angle[TR_ZS])/36.0); al = (tdble)((curSeg->angle[TR_ZE] - curSeg->angle[TR_ZS])/36.0);
alfl = curSeg->angle[TR_ZS]; alfl = curSeg->angle[TR_ZS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curSeg->center.x - (innerradius + width) * sin(alfl); /* location of end */ x1 = curSeg->center.x - (innerradius + width) * sin(alfl); /* location of end */
y1 = curSeg->center.y + (innerradius + width) * cos(alfl); y1 = curSeg->center.y + (innerradius + width) * cos(alfl);

View file

@ -128,11 +128,10 @@ AddTrackSurface(void *TrackHandle, tTrack *theTrack, const char *material)
static void static void
InitSides(void *TrackHandle, tTrack *theTrack) InitSides(void *TrackHandle, tTrack *theTrack)
{ {
int side;
const char *style; const char *style;
static char path[BUFSIZE]; static char path[BUFSIZE];
for (side = 0; side < 2; side++) { for (int side = 0; side < 2; side++) {
/* Sides */ /* Sides */
snprintf(path, sizeof(path), "%s/%s", TRK_SECT_MAIN, SectSide[side]); snprintf(path, sizeof(path), "%s/%s", TRK_SECT_MAIN, SectSide[side]);
sideMaterial[side] = GfParmGetStr(TrackHandle, path, TRK_ATT_SURF, TRK_VAL_GRASS); sideMaterial[side] = GfParmGetStr(TrackHandle, path, TRK_ATT_SURF, TRK_VAL_GRASS);
@ -186,13 +185,11 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
tTrackBarrier *curBarrier; tTrackBarrier *curBarrier;
tdble x, y, z; tdble x, y, z;
tdble al, alfl; tdble al, alfl;
int j;
tdble x1, x2, y1, y2; tdble x1, x2, y1, y2;
tdble w, sw, ew, bw; tdble w, sw, ew, bw;
tdble minWidth; tdble minWidth;
tdble maxWidth; tdble maxWidth;
int type; int type;
int side;
const char *style; const char *style;
tdble Kew; tdble Kew;
static char path[BUFSIZE]; static char path[BUFSIZE];
@ -205,7 +202,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
snprintf(path, sizeof(path), "%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS); snprintf(path, sizeof(path), "%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS);
segName = GfParmListGetCurEltName(TrackHandle, path); segName = GfParmListGetCurEltName(TrackHandle, path);
snprintf(path, sizeof(path), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName); snprintf(path, sizeof(path), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName);
for (side = 0; side < 2; side++) { for (int side = 0; side < 2; side++) {
curSeg = mSeg; curSeg = mSeg;
if (curStep == 0) { if (curStep == 0) {
/* Side parameters */ /* Side parameters */
@ -358,7 +355,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curBorder->arc / 36.0); al = (tdble)(curBorder->arc / 36.0);
alfl = curBorder->angle[TR_CS]; alfl = curBorder->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curBorder->center.x + (curBorder->radiusl) * cos(alfl); /* location of end */ x1 = curBorder->center.x + (curBorder->radiusl) * cos(alfl); /* location of end */
y1 = curBorder->center.y + (curBorder->radiusl) * sin(alfl); y1 = curBorder->center.y + (curBorder->radiusl) * sin(alfl);
@ -395,7 +392,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curBorder->arc / 36.0); al = (tdble)(curBorder->arc / 36.0);
alfl = curBorder->angle[TR_CS]; alfl = curBorder->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curBorder->center.x + (curBorder->radiusr) * cos(alfl); /* location of end */ x2 = curBorder->center.x + (curBorder->radiusr) * cos(alfl); /* location of end */
y2 = curBorder->center.y + (curBorder->radiusr) * sin(alfl); y2 = curBorder->center.y + (curBorder->radiusr) * sin(alfl);
@ -439,7 +436,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curBorder->arc / 36.0); al = (tdble)(curBorder->arc / 36.0);
alfl = curBorder->angle[TR_CS]; alfl = curBorder->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x1 = curBorder->center.x + (curBorder->radiusl) * cos(alfl); /* location of end */ x1 = curBorder->center.x + (curBorder->radiusl) * cos(alfl); /* location of end */
y1 = curBorder->center.y + (curBorder->radiusl) * sin(alfl); y1 = curBorder->center.y + (curBorder->radiusl) * sin(alfl);
@ -476,7 +473,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curBorder->arc / 36.0); al = (tdble)(curBorder->arc / 36.0);
alfl = curBorder->angle[TR_CS]; alfl = curBorder->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x2 = curBorder->center.x + (curBorder->radiusr) * cos(alfl); /* location of end */ x2 = curBorder->center.x + (curBorder->radiusr) * cos(alfl); /* location of end */
y2 = curBorder->center.y + (curBorder->radiusr) * sin(alfl); y2 = curBorder->center.y + (curBorder->radiusr) * sin(alfl);
@ -594,7 +591,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curSide->arc / 36.0); al = (tdble)(curSide->arc / 36.0);
alfl = curSide->angle[TR_CS]; alfl = curSide->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curSide->center.x + (curSide->radiusl) * cos(alfl); x2 = curSide->center.x + (curSide->radiusl) * cos(alfl);
y2 = curSide->center.y + (curSide->radiusl) * sin(alfl); y2 = curSide->center.y + (curSide->radiusl) * sin(alfl);
@ -631,7 +628,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curSide->arc / 36.0); al = (tdble)(curSide->arc / 36.0);
alfl = curSide->angle[TR_CS]; alfl = curSide->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curSide->center.x + (curSide->radiusr) * cos(alfl); x2 = curSide->center.x + (curSide->radiusr) * cos(alfl);
y2 = curSide->center.y + (curSide->radiusr) * sin(alfl); y2 = curSide->center.y + (curSide->radiusr) * sin(alfl);
@ -675,7 +672,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curSide->arc / 36.0); al = (tdble)(curSide->arc / 36.0);
alfl = curSide->angle[TR_CS]; alfl = curSide->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x1 = curSide->center.x + (curSide->radiusl) * cos(alfl); /* location of end */ x1 = curSide->center.x + (curSide->radiusl) * cos(alfl); /* location of end */
y1 = curSide->center.y + (curSide->radiusl) * sin(alfl); y1 = curSide->center.y + (curSide->radiusl) * sin(alfl);
@ -712,7 +709,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curSide->arc / 36.0); al = (tdble)(curSide->arc / 36.0);
alfl = curSide->angle[TR_CS]; alfl = curSide->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x2 = curSide->center.x + (curSide->radiusr) * cos(alfl); /* location of end */ x2 = curSide->center.x + (curSide->radiusr) * cos(alfl); /* location of end */
y2 = curSide->center.y + (curSide->radiusr) * sin(alfl); y2 = curSide->center.y + (curSide->radiusr) * sin(alfl);
@ -777,9 +774,6 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
// @param TrackHandle handle of the track XML file // @param TrackHandle handle of the track XML file
// @return true on success // @return true on success
static bool InitPits(tTrack *theTrack, void *TrackHandle) { static bool InitPits(tTrack *theTrack, void *TrackHandle) {
int i;
int segId;
//Set each pit-related ptr to initial value //Set each pit-related ptr to initial value
pitEntrySeg = NULL; pitEntrySeg = NULL;
pitExitSeg = NULL; pitExitSeg = NULL;
@ -799,9 +793,9 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) { if (segName != 0) {
//Search for pit entry //Search for pit entry
snprintf(path, sizeof(path), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName); snprintf(path, sizeof(path), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName);
segId = (int)GfParmGetNum(TrackHandle, path, TRK_ATT_ID, (char*)NULL, -1); int segId = (int)GfParmGetNum(TrackHandle, path, TRK_ATT_ID, (char*)NULL, -1);
pitEntrySeg = theTrack->seg; pitEntrySeg = theTrack->seg;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
if (pitEntrySeg->id == segId) { if (pitEntrySeg->id == segId) {
found = true; found = true;
} else if (found) { } else if (found) {
@ -821,7 +815,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */ /* Search backward the last segment with that name */
pitExitSeg = theTrack->seg; /* last track segment */ pitExitSeg = theTrack->seg; /* last track segment */
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
/* set the flag on the last segment of pit_exit */ /* set the flag on the last segment of pit_exit */
if (!strcmp(segName, pitExitSeg->name)) { if (!strcmp(segName, pitExitSeg->name)) {
found = true; found = true;
@ -840,7 +834,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) { if (segName != 0) {
pitStart = theTrack->seg; pitStart = theTrack->seg;
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitStart->name)) { if (!strcmp(segName, pitStart->name)) {
found = true; found = true;
} else if (found) { } else if (found) {
@ -861,7 +855,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) { if (segName != 0) {
pitBuildingsStart = theTrack->seg; pitBuildingsStart = theTrack->seg;
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitBuildingsStart->name)) { if (!strcmp(segName, pitBuildingsStart->name)) {
found = true; found = true;
} else if (found) { } else if (found) {
@ -885,7 +879,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */ /* Search backward the last segment with that name */
pitEnd = theTrack->seg; /* last track segment */ pitEnd = theTrack->seg; /* last track segment */
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitEnd->name)) { if (!strcmp(segName, pitEnd->name)) {
found = true; found = true;
break; break;
@ -906,7 +900,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */ /* Search backward the last segment with that name */
pitBuildingsEnd = theTrack->seg; /* last track segment */ pitBuildingsEnd = theTrack->seg; /* last track segment */
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitBuildingsEnd->name)) { if (!strcmp(segName, pitBuildingsEnd->name)) {
found = true; found = true;
break; break;
@ -1188,7 +1182,6 @@ normSeg(tTrackSeg *curSeg)
static void static void
CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *end, int ext) CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *end, int ext)
{ {
int j;
int segread, curindex; int segread, curindex;
tdble radius, radiusend = 0, dradius; tdble radius, radiusend = 0, dradius;
tdble innerradius; tdble innerradius;
@ -1606,7 +1599,7 @@ CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *
al = (tdble)(curArc / 36.0); al = (tdble)(curArc / 36.0);
alfl = curSeg->angle[TR_CS]; alfl = curSeg->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curSeg->center.x + (innerradius) * cos(alfl); /* location of end */ x1 = curSeg->center.x + (innerradius) * cos(alfl); /* location of end */
y1 = curSeg->center.y + (innerradius) * sin(alfl); y1 = curSeg->center.y + (innerradius) * sin(alfl);
@ -1674,7 +1667,7 @@ CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *
al = (tdble)(curSeg->arc / 36.0); al = (tdble)(curSeg->arc / 36.0);
alfl = curSeg->angle[TR_CS]; alfl = curSeg->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x1 = curSeg->center.x + (innerradius + width) * cos(alfl); /* location of end */ x1 = curSeg->center.x + (innerradius + width) * cos(alfl); /* location of end */
y1 = curSeg->center.y + (innerradius + width) * sin(alfl); y1 = curSeg->center.y + (innerradius + width) * sin(alfl);
@ -1723,7 +1716,6 @@ CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *
*/ */
void ReadTrack4(tTrack *theTrack, void *TrackHandle, void ReadTrack4(tTrack *theTrack, void *TrackHandle,
tRoadCam **camList, int ext) { tRoadCam **camList, int ext) {
int i;
tTrackSeg *curSeg = NULL; tTrackSeg *curSeg = NULL;
int segId; int segId;
tRoadCam *curCam; tRoadCam *curCam;
@ -1767,7 +1759,7 @@ void ReadTrack4(tTrack *theTrack, void *TrackHandle,
snprintf(path2, sizeof(path2), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName); snprintf(path2, sizeof(path2), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName);
segId = (int)GfParmGetNum(TrackHandle, path2, TRK_ATT_ID, (char*)NULL, 0); segId = (int)GfParmGetNum(TrackHandle, path2, TRK_ATT_ID, (char*)NULL, 0);
curSeg = theTrack->seg; curSeg = theTrack->seg;
for(i=0; i<theTrack->nseg; i++) { for (int i=0; i<theTrack->nseg; i++) {
if (curSeg->id == segId) { if (curSeg->id == segId) {
break; break;
} }
@ -1787,7 +1779,7 @@ void ReadTrack4(tTrack *theTrack, void *TrackHandle,
snprintf(path2, sizeof(path2), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName); snprintf(path2, sizeof(path2), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName);
segId = (int)GfParmGetNum(TrackHandle, path2, TRK_ATT_ID, (char*)NULL, 0); segId = (int)GfParmGetNum(TrackHandle, path2, TRK_ATT_ID, (char*)NULL, 0);
curSeg = theTrack->seg; curSeg = theTrack->seg;
for(i=0; i<theTrack->nseg; i++) { for (int i=0; i<theTrack->nseg; i++) {
if (curSeg->id == segId) { if (curSeg->id == segId) {
break; break;
} }
@ -1816,7 +1808,7 @@ void ReadTrack4(tTrack *theTrack, void *TrackHandle,
theTrack->max.z = zmax - zmin; theTrack->max.z = zmax - zmin;
curSeg = theTrack->seg; curSeg = theTrack->seg;
for(i=0; i<theTrack->nseg; i++) { /* read the segment data: */ for (int i=0; i<theTrack->nseg; i++) { /* read the segment data: */
if ((curSeg->lgfromstart + curSeg->length) > (theTrack->length - 50.0)) { if ((curSeg->lgfromstart + curSeg->length) > (theTrack->length - 50.0)) {
curSeg->raceInfo |= TR_LAST; curSeg->raceInfo |= TR_LAST;
} else if (curSeg->lgfromstart < 50.0) { } else if (curSeg->lgfromstart < 50.0) {

View file

@ -210,13 +210,11 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
tTrackBarrier *curBarrier; tTrackBarrier *curBarrier;
tdble x, y, z; tdble x, y, z;
tdble al, alfl; tdble al, alfl;
int j;
tdble x1, x2, y1, y2; tdble x1, x2, y1, y2;
tdble w, sw, ew, bw; tdble w, sw, ew, bw;
tdble minWidth; tdble minWidth;
tdble maxWidth; tdble maxWidth;
int type; int type;
int side;
const char *style; const char *style;
tdble Kew; tdble Kew;
static char path[BUFSIZE]; static char path[BUFSIZE];
@ -229,7 +227,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
snprintf(path, sizeof(path), "%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS); snprintf(path, sizeof(path), "%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS);
segName = GfParmListGetCurEltName(TrackHandle, path); segName = GfParmListGetCurEltName(TrackHandle, path);
snprintf(path, sizeof(path), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName); snprintf(path, sizeof(path), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName);
for (side = 0; side < 2; side++) { for (int side = 0; side < 2; side++) {
curSeg = mSeg; curSeg = mSeg;
if (curStep == 0) { if (curStep == 0) {
/* Side parameters */ /* Side parameters */
@ -382,7 +380,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curBorder->arc / 36.0); al = (tdble)(curBorder->arc / 36.0);
alfl = curBorder->angle[TR_CS]; alfl = curBorder->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curBorder->center.x + (curBorder->radiusl) * cos(alfl); /* location of end */ x1 = curBorder->center.x + (curBorder->radiusl) * cos(alfl); /* location of end */
y1 = curBorder->center.y + (curBorder->radiusl) * sin(alfl); y1 = curBorder->center.y + (curBorder->radiusl) * sin(alfl);
@ -419,7 +417,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curBorder->arc / 36.0); al = (tdble)(curBorder->arc / 36.0);
alfl = curBorder->angle[TR_CS]; alfl = curBorder->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curBorder->center.x + (curBorder->radiusr) * cos(alfl); /* location of end */ x2 = curBorder->center.x + (curBorder->radiusr) * cos(alfl); /* location of end */
y2 = curBorder->center.y + (curBorder->radiusr) * sin(alfl); y2 = curBorder->center.y + (curBorder->radiusr) * sin(alfl);
@ -463,7 +461,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curBorder->arc / 36.0); al = (tdble)(curBorder->arc / 36.0);
alfl = curBorder->angle[TR_CS]; alfl = curBorder->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x1 = curBorder->center.x + (curBorder->radiusl) * cos(alfl); /* location of end */ x1 = curBorder->center.x + (curBorder->radiusl) * cos(alfl); /* location of end */
y1 = curBorder->center.y + (curBorder->radiusl) * sin(alfl); y1 = curBorder->center.y + (curBorder->radiusl) * sin(alfl);
@ -500,7 +498,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curBorder->arc / 36.0); al = (tdble)(curBorder->arc / 36.0);
alfl = curBorder->angle[TR_CS]; alfl = curBorder->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x2 = curBorder->center.x + (curBorder->radiusr) * cos(alfl); /* location of end */ x2 = curBorder->center.x + (curBorder->radiusr) * cos(alfl); /* location of end */
y2 = curBorder->center.y + (curBorder->radiusr) * sin(alfl); y2 = curBorder->center.y + (curBorder->radiusr) * sin(alfl);
@ -618,7 +616,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curSide->arc / 36.0); al = (tdble)(curSide->arc / 36.0);
alfl = curSide->angle[TR_CS]; alfl = curSide->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curSide->center.x + (curSide->radiusl) * cos(alfl); x2 = curSide->center.x + (curSide->radiusl) * cos(alfl);
y2 = curSide->center.y + (curSide->radiusl) * sin(alfl); y2 = curSide->center.y + (curSide->radiusl) * sin(alfl);
@ -655,7 +653,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curSide->arc / 36.0); al = (tdble)(curSide->arc / 36.0);
alfl = curSide->angle[TR_CS]; alfl = curSide->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x2 = curSide->center.x + (curSide->radiusr) * cos(alfl); x2 = curSide->center.x + (curSide->radiusr) * cos(alfl);
y2 = curSide->center.y + (curSide->radiusr) * sin(alfl); y2 = curSide->center.y + (curSide->radiusr) * sin(alfl);
@ -699,7 +697,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curSide->arc / 36.0); al = (tdble)(curSide->arc / 36.0);
alfl = curSide->angle[TR_CS]; alfl = curSide->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x1 = curSide->center.x + (curSide->radiusl) * cos(alfl); /* location of end */ x1 = curSide->center.x + (curSide->radiusl) * cos(alfl); /* location of end */
y1 = curSide->center.y + (curSide->radiusl) * sin(alfl); y1 = curSide->center.y + (curSide->radiusl) * sin(alfl);
@ -736,7 +734,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
al = (tdble)(curSide->arc / 36.0); al = (tdble)(curSide->arc / 36.0);
alfl = curSide->angle[TR_CS]; alfl = curSide->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x2 = curSide->center.x + (curSide->radiusr) * cos(alfl); /* location of end */ x2 = curSide->center.x + (curSide->radiusr) * cos(alfl); /* location of end */
y2 = curSide->center.y + (curSide->radiusr) * sin(alfl); y2 = curSide->center.y + (curSide->radiusr) * sin(alfl);
@ -801,9 +799,6 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
// @param TrackHandle handle of the track XML file // @param TrackHandle handle of the track XML file
// @return true on success // @return true on success
static bool InitPits(tTrack *theTrack, void *TrackHandle) { static bool InitPits(tTrack *theTrack, void *TrackHandle) {
int i;
int segId;
//Set each pit-related ptr to initial value //Set each pit-related ptr to initial value
pitEntrySeg = NULL; pitEntrySeg = NULL;
pitExitSeg = NULL; pitExitSeg = NULL;
@ -823,9 +818,9 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) { if (segName != 0) {
//Search for pit entry //Search for pit entry
snprintf(path, sizeof(path), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName); snprintf(path, sizeof(path), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName);
segId = (int)GfParmGetNum(TrackHandle, path, TRK_ATT_ID, (char*)NULL, -1); int segId = (int)GfParmGetNum(TrackHandle, path, TRK_ATT_ID, (char*)NULL, -1);
pitEntrySeg = theTrack->seg; pitEntrySeg = theTrack->seg;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
if (pitEntrySeg->id == segId) { if (pitEntrySeg->id == segId) {
found = true; found = true;
} else if (found) { } else if (found) {
@ -846,7 +841,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */ /* Search backward the last segment with that name */
pitExitSeg = theTrack->seg; /* last track segment */ pitExitSeg = theTrack->seg; /* last track segment */
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
/* set the flag on the last segment of pit_exit */ /* set the flag on the last segment of pit_exit */
if (!strcmp(segName, pitExitSeg->name)) { if (!strcmp(segName, pitExitSeg->name)) {
found = true; found = true;
@ -865,7 +860,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) { if (segName != 0) {
pitStart = theTrack->seg; pitStart = theTrack->seg;
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitStart->name)) { if (!strcmp(segName, pitStart->name)) {
found = true; found = true;
} else if (found) { } else if (found) {
@ -886,7 +881,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) { if (segName != 0) {
pitBuildingsStart = theTrack->seg; pitBuildingsStart = theTrack->seg;
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitBuildingsStart->name)) { if (!strcmp(segName, pitBuildingsStart->name)) {
found = true; found = true;
} else if (found) { } else if (found) {
@ -911,7 +906,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */ /* Search backward the last segment with that name */
pitEnd = theTrack->seg; /* last track segment */ pitEnd = theTrack->seg; /* last track segment */
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) for (int i = 0; i <= theTrack->nseg; i++)
{ {
if (!strcmp(segName, pitEnd->name)) if (!strcmp(segName, pitEnd->name))
{ {
@ -936,7 +931,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */ /* Search backward the last segment with that name */
pitBuildingsEnd = theTrack->seg; /* last track segment */ pitBuildingsEnd = theTrack->seg; /* last track segment */
found = false; found = false;
for(i = 0; i <= theTrack->nseg; i++) { for (int i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitBuildingsEnd->name)) { if (!strcmp(segName, pitBuildingsEnd->name)) {
found = true; found = true;
break; break;
@ -1219,7 +1214,6 @@ normSeg(tTrackSeg *curSeg)
static void static void
CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *end, int ext) CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *end, int ext)
{ {
int j;
int segread, curindex; int segread, curindex;
tdble radius, radiusend = 0, dradius; tdble radius, radiusend = 0, dradius;
tdble innerradius; tdble innerradius;
@ -1644,7 +1638,7 @@ CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *
al = (tdble)(curArc / 36.0); al = (tdble)(curArc / 36.0);
alfl = curSeg->angle[TR_CS]; alfl = curSeg->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl += al; alfl += al;
x1 = curSeg->center.x + (innerradius) * cos(alfl); /* location of end */ x1 = curSeg->center.x + (innerradius) * cos(alfl); /* location of end */
y1 = curSeg->center.y + (innerradius) * sin(alfl); y1 = curSeg->center.y + (innerradius) * sin(alfl);
@ -1712,7 +1706,7 @@ CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *
al = (tdble)(curSeg->arc / 36.0); al = (tdble)(curSeg->arc / 36.0);
alfl = curSeg->angle[TR_CS]; alfl = curSeg->angle[TR_CS];
for (j = 0; j < 36; j++) { for (int j = 0; j < 36; j++) {
alfl -= al; alfl -= al;
x1 = curSeg->center.x + (innerradius + width) * cos(alfl); /* location of end */ x1 = curSeg->center.x + (innerradius + width) * cos(alfl); /* location of end */
y1 = curSeg->center.y + (innerradius + width) * sin(alfl); y1 = curSeg->center.y + (innerradius + width) * sin(alfl);
@ -1761,7 +1755,6 @@ CreateSegRing(void *TrackHandle, tTrack *theTrack, tTrackSeg *start, tTrackSeg *
*/ */
void ReadTrack5(tTrack *theTrack, void *TrackHandle, void ReadTrack5(tTrack *theTrack, void *TrackHandle,
tRoadCam **camList, int ext) { tRoadCam **camList, int ext) {
int i;
tTrackSeg *curSeg = NULL; tTrackSeg *curSeg = NULL;
int segId; int segId;
tRoadCam *curCam; tRoadCam *curCam;
@ -1806,7 +1799,7 @@ void ReadTrack5(tTrack *theTrack, void *TrackHandle,
snprintf(path2, sizeof(path2), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName); snprintf(path2, sizeof(path2), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName);
segId = (int)GfParmGetNum(TrackHandle, path2, TRK_ATT_ID, (char*)NULL, 0); segId = (int)GfParmGetNum(TrackHandle, path2, TRK_ATT_ID, (char*)NULL, 0);
curSeg = theTrack->seg; curSeg = theTrack->seg;
for(i=0; i<theTrack->nseg; i++) { for (int i=0; i<theTrack->nseg; i++) {
if (curSeg->id == segId) { if (curSeg->id == segId) {
break; break;
} }
@ -1826,7 +1819,7 @@ void ReadTrack5(tTrack *theTrack, void *TrackHandle,
snprintf(path2, sizeof(path2), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName); snprintf(path2, sizeof(path2), "%s/%s/%s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, segName);
segId = (int)GfParmGetNum(TrackHandle, path2, TRK_ATT_ID, (char*)NULL, 0); segId = (int)GfParmGetNum(TrackHandle, path2, TRK_ATT_ID, (char*)NULL, 0);
curSeg = theTrack->seg; curSeg = theTrack->seg;
for(i=0; i<theTrack->nseg; i++) { for (int i=0; i<theTrack->nseg; i++) {
if (curSeg->id == segId) { if (curSeg->id == segId) {
break; break;
} }
@ -1862,7 +1855,7 @@ void ReadTrack5(tTrack *theTrack, void *TrackHandle,
theTrack->max.z = zmax - zmin; theTrack->max.z = zmax - zmin;
curSeg = theTrack->seg; curSeg = theTrack->seg;
for(i=0; i<theTrack->nseg; i++) { /* read the segment data: */ for (int i=0; i<theTrack->nseg; i++) { /* read the segment data: */
if ((curSeg->lgfromstart + curSeg->length) > (theTrack->length - 50.0)) { if ((curSeg->lgfromstart + curSeg->length) > (theTrack->length - 50.0)) {
curSeg->raceInfo |= TR_LAST; curSeg->raceInfo |= TR_LAST;
} else if (curSeg->lgfromstart < 50.0) { } else if (curSeg->lgfromstart < 50.0) {