Fix for Ticket 951. Loops off by one.

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

Former-commit-id: dbd15d3da2fcffe95d99a3ccbce19b118365fdd2
Former-commit-id: 845e1e091ecfb8c5279db2dd93a08f13936070fc
This commit is contained in:
beaglejoe 2016-03-27 05:12:39 +00:00
parent 9e1ea78f8b
commit ced2a837a0
3 changed files with 13 additions and 13 deletions

View file

@ -804,7 +804,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
sprintf(path, "%s/%s/%.*s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, (int)(sizeof(path) - strlen(TRK_SECT_MAIN) - strlen(TRK_LST_SEGMENTS)), segName);
segId = (int)GfParmGetNum(TrackHandle, path, TRK_ATT_ID, (char*)NULL, -1);
pitEntrySeg = theTrack->seg;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
if (pitEntrySeg->id == segId) {
found = true;
} else if (found) {
@ -824,7 +824,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */
pitExitSeg = theTrack->seg; /* last track segment */
found = false;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
/* set the flag on the last segment of pit_exit */
if (!strcmp(segName, pitExitSeg->name)) {
found = true;
@ -843,7 +843,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) {
pitStart = theTrack->seg;
found = false;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitStart->name)) {
found = true;
} else if (found) {
@ -864,7 +864,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) {
pitBuildingsStart = theTrack->seg;
found = false;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitBuildingsStart->name)) {
found = true;
} else if (found) {
@ -888,7 +888,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */
pitEnd = theTrack->seg; /* last track segment */
found = false;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitEnd->name)) {
found = true;
break;
@ -909,7 +909,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */
pitBuildingsEnd = theTrack->seg; /* last track segment */
found = false;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitBuildingsEnd->name)) {
found = true;
break;

View file

@ -828,7 +828,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
sprintf(path, "%s/%s/%.*s", TRK_SECT_MAIN, TRK_LST_SEGMENTS, (int)(sizeof(path) - strlen(TRK_SECT_MAIN) - strlen(TRK_LST_SEGMENTS)), segName);
segId = (int)GfParmGetNum(TrackHandle, path, TRK_ATT_ID, (char*)NULL, -1);
pitEntrySeg = theTrack->seg;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
if (pitEntrySeg->id == segId) {
found = true;
} else if (found) {
@ -849,7 +849,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */
pitExitSeg = theTrack->seg; /* last track segment */
found = false;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
/* set the flag on the last segment of pit_exit */
if (!strcmp(segName, pitExitSeg->name)) {
found = true;
@ -868,7 +868,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) {
pitStart = theTrack->seg;
found = false;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitStart->name)) {
found = true;
} else if (found) {
@ -889,7 +889,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
if (segName != 0) {
pitBuildingsStart = theTrack->seg;
found = false;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitBuildingsStart->name)) {
found = true;
} else if (found) {
@ -914,7 +914,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */
pitEnd = theTrack->seg; /* last track segment */
found = false;
for(i = 0; i < theTrack->nseg; i++)
for(i = 0; i <= theTrack->nseg; i++)
{
if (!strcmp(segName, pitEnd->name))
{
@ -939,7 +939,7 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
/* Search backward the last segment with that name */
pitBuildingsEnd = theTrack->seg; /* last track segment */
found = false;
for(i = 0; i < theTrack->nseg; i++) {
for(i = 0; i <= theTrack->nseg; i++) {
if (!strcmp(segName, pitBuildingsEnd->name)) {
found = true;
break;

View file

@ -119,7 +119,7 @@ static void initPits(tTrack *theTrack, void *TrackHandle, tTrackPitInfo *pits) {
if (segName != 0) {
pitBuildingsStart = theTrack->seg;
found = false;
for(i = 0; i < theTrack->nseg; i++)
for(i = 0; i <= theTrack->nseg; i++)
{
if (!strcmp(segName, pitBuildingsStart->name))
{