forked from speed-dreams/speed-dreams-code
Bugfix: If no parameter stop building is defined, use pit end as default.
Work in progress! Other parameter have to be checked as well! git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6386 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 3b0410327597869e84675b66d54427f03074de86 Former-commit-id: 18427ac7e3f9fb8b3cb99c1df07710b43b4a6776
This commit is contained in:
parent
aa5730e559
commit
c9e7bb4fd0
4 changed files with 64 additions and 58 deletions
|
@ -205,7 +205,7 @@
|
||||||
#define TRK_ATT_PIT_INDICATOR "pit indicator"
|
#define TRK_ATT_PIT_INDICATOR "pit indicator"
|
||||||
#define TRK_ATT_MAX_PITS "max pits"
|
#define TRK_ATT_MAX_PITS "max pits"
|
||||||
#define TRK_ATT_BUILDINGS_START "start buildings"
|
#define TRK_ATT_BUILDINGS_START "start buildings"
|
||||||
#define TRK_ATT_BUILDINGS_STOPP "stop buildings"
|
#define TRK_ATT_BUILDINGS_STOP "stop buildings"
|
||||||
#define TRK_ATT_PIT_STYLE "pit style"
|
#define TRK_ATT_PIT_STYLE "pit style"
|
||||||
#define TRK_ATT_ENTRY "entry"
|
#define TRK_ATT_ENTRY "entry"
|
||||||
#define TRK_ATT_EXIT "exit"
|
#define TRK_ATT_EXIT "exit"
|
||||||
|
|
|
@ -1396,25 +1396,10 @@ ReadTrack3(tTrack *theTrack, void *TrackHandle, tRoadCam **camList, int ext)
|
||||||
pitBuildingsStart = pitBuildingsStart->prev;
|
pitBuildingsStart = pitBuildingsStart->prev;
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
pitBuildingsStart = NULL;
|
pitBuildingsStart = pitStart;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}
|
pitBuildingsStart = pitStart;
|
||||||
|
|
||||||
segName = GfParmGetStr(TrackHandle, TRK_SECT_MAIN, TRK_ATT_BUILDINGS_STOPP, NULL);
|
|
||||||
if (segName != 0) {
|
|
||||||
pitBuildingsEnd = theTrack->seg;
|
|
||||||
found = 0;
|
|
||||||
for(i = 0; i < theTrack->nseg; i++) {
|
|
||||||
if (!strcmp(segName, pitBuildingsEnd->name)) {
|
|
||||||
found = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pitBuildingsEnd = pitBuildingsEnd->prev;
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
pitBuildingsEnd = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
segName = GfParmGetStr(TrackHandle, TRK_SECT_MAIN, TRK_ATT_PIT_END, NULL);
|
segName = GfParmGetStr(TrackHandle, TRK_SECT_MAIN, TRK_ATT_PIT_END, NULL);
|
||||||
|
@ -1433,6 +1418,24 @@ ReadTrack3(tTrack *theTrack, void *TrackHandle, tRoadCam **camList, int ext)
|
||||||
if (!found) {
|
if (!found) {
|
||||||
pitEnd = NULL;
|
pitEnd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
segName = GfParmGetStr(TrackHandle, TRK_SECT_MAIN, TRK_ATT_BUILDINGS_STOP, NULL);
|
||||||
|
if (segName != 0) {
|
||||||
|
pitBuildingsEnd = theTrack->seg;
|
||||||
|
found = 0;
|
||||||
|
for(i = 0; i < theTrack->nseg; i++) {
|
||||||
|
if (!strcmp(segName, pitBuildingsEnd->name)) {
|
||||||
|
found = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pitBuildingsEnd = pitBuildingsEnd->prev;
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
pitBuildingsEnd = pitEnd;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pitBuildingsEnd = pitEnd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
paramVal = GfParmGetStr(TrackHandle, TRK_SECT_MAIN, TRK_ATT_PIT_SIDE, "right");
|
paramVal = GfParmGetStr(TrackHandle, TRK_SECT_MAIN, TRK_ATT_PIT_SIDE, "right");
|
||||||
if (strcmp(paramVal, "right") == 0) {
|
if (strcmp(paramVal, "right") == 0) {
|
||||||
|
|
|
@ -880,25 +880,6 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
|
||||||
}
|
}
|
||||||
GfOut("PitBuildingStart: %s\n", pitBuildingsStart->name);
|
GfOut("PitBuildingStart: %s\n", pitBuildingsStart->name);
|
||||||
|
|
||||||
//Search for pit buildings end
|
|
||||||
segName = GfParmGetStrNC(TrackHandle, path2, TRK_ATT_BUILDINGS_STOPP, NULL);
|
|
||||||
if (segName != 0) {
|
|
||||||
/* Search backward the last segment with that name */
|
|
||||||
pitBuildingsEnd = theTrack->seg; /* last track segment */
|
|
||||||
found = false;
|
|
||||||
for(i = 0; i < theTrack->nseg; i++) {
|
|
||||||
if (!strcmp(segName, pitBuildingsEnd->name)) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pitBuildingsEnd = pitBuildingsEnd->prev;
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
pitBuildingsEnd = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GfOut("PitBuildungsEnd: %s\n", pitBuildingsEnd->name);
|
|
||||||
|
|
||||||
//Search for pits end
|
//Search for pits end
|
||||||
segName = GfParmGetStrNC(TrackHandle, path2, TRK_ATT_END, NULL);
|
segName = GfParmGetStrNC(TrackHandle, path2, TRK_ATT_END, NULL);
|
||||||
if (segName != 0) {
|
if (segName != 0) {
|
||||||
|
@ -918,6 +899,27 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
|
||||||
}
|
}
|
||||||
GfOut("PitEnd: %s\n", pitEnd->name);
|
GfOut("PitEnd: %s\n", pitEnd->name);
|
||||||
|
|
||||||
|
//Search for pit buildings end
|
||||||
|
segName = GfParmGetStrNC(TrackHandle, path2, TRK_ATT_BUILDINGS_STOP, NULL);
|
||||||
|
if (segName != 0) {
|
||||||
|
/* Search backward the last segment with that name */
|
||||||
|
pitBuildingsEnd = theTrack->seg; /* last track segment */
|
||||||
|
found = false;
|
||||||
|
for(i = 0; i < theTrack->nseg; i++) {
|
||||||
|
if (!strcmp(segName, pitBuildingsEnd->name)) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pitBuildingsEnd = pitBuildingsEnd->prev;
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
pitBuildingsEnd = pitEnd;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pitBuildingsEnd = pitEnd;
|
||||||
|
}
|
||||||
|
GfOut("PitBuildungsEnd: %s\n", pitBuildingsEnd->name);
|
||||||
|
|
||||||
//Decide which side the pit is located
|
//Decide which side the pit is located
|
||||||
const char *paramVal = GfParmGetStr(TrackHandle, path2, TRK_ATT_SIDE, "right");
|
const char *paramVal = GfParmGetStr(TrackHandle, path2, TRK_ATT_SIDE, "right");
|
||||||
pits->side = (strcmp(paramVal, "right") == 0) ? TR_RGT : TR_LFT;
|
pits->side = (strcmp(paramVal, "right") == 0) ? TR_RGT : TR_LFT;
|
||||||
|
|
|
@ -904,25 +904,6 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
|
||||||
}
|
}
|
||||||
GfOut("PitBuildingStart: %s\n", pitBuildingsStart->name);
|
GfOut("PitBuildingStart: %s\n", pitBuildingsStart->name);
|
||||||
|
|
||||||
//Search for pit buildings end
|
|
||||||
segName = GfParmGetStrNC(TrackHandle, path2, TRK_ATT_BUILDINGS_STOPP, NULL);
|
|
||||||
if (segName != 0) {
|
|
||||||
/* Search backward the last segment with that name */
|
|
||||||
pitBuildingsEnd = theTrack->seg; /* last track segment */
|
|
||||||
found = false;
|
|
||||||
for(i = 0; i < theTrack->nseg; i++) {
|
|
||||||
if (!strcmp(segName, pitBuildingsEnd->name)) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pitBuildingsEnd = pitBuildingsEnd->prev;
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
pitBuildingsEnd = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GfOut("PitBuildungsEnd: %s\n", pitBuildingsEnd->name);
|
|
||||||
|
|
||||||
//Search for pits end
|
//Search for pits end
|
||||||
segName = GfParmGetStrNC(TrackHandle, path2, TRK_ATT_END, NULL);
|
segName = GfParmGetStrNC(TrackHandle, path2, TRK_ATT_END, NULL);
|
||||||
if (segName != 0)
|
if (segName != 0)
|
||||||
|
@ -946,9 +927,29 @@ static bool InitPits(tTrack *theTrack, void *TrackHandle) {
|
||||||
pitEnd = NULL;
|
pitEnd = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GfOut("PitEnd: %s\n", pitEnd->name);
|
GfOut("PitEnd: %s\n", pitEnd->name);
|
||||||
|
|
||||||
|
//Search for pit buildings end
|
||||||
|
segName = GfParmGetStrNC(TrackHandle, path2, TRK_ATT_BUILDINGS_STOP, NULL);
|
||||||
|
if (segName != 0) {
|
||||||
|
/* Search backward the last segment with that name */
|
||||||
|
pitBuildingsEnd = theTrack->seg; /* last track segment */
|
||||||
|
found = false;
|
||||||
|
for(i = 0; i < theTrack->nseg; i++) {
|
||||||
|
if (!strcmp(segName, pitBuildingsEnd->name)) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pitBuildingsEnd = pitBuildingsEnd->prev;
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
pitBuildingsEnd = pitEnd;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pitBuildingsEnd = pitEnd;
|
||||||
|
}
|
||||||
|
GfOut("PitBuildungsEnd: %s\n", pitBuildingsEnd->name);
|
||||||
|
|
||||||
//Decide which side the pit is located
|
//Decide which side the pit is located
|
||||||
const char *paramVal = GfParmGetStr(TrackHandle, path2, TRK_ATT_SIDE, "right");
|
const char *paramVal = GfParmGetStr(TrackHandle, path2, TRK_ATT_SIDE, "right");
|
||||||
pits->side = (strcmp(paramVal, "right") == 0) ? TR_RGT : TR_LFT;
|
pits->side = (strcmp(paramVal, "right") == 0) ? TR_RGT : TR_LFT;
|
||||||
|
|
Loading…
Reference in a new issue