fix reading segment side width

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

Former-commit-id: 73252cb84cbd4c2578fe866c367c6c30cae01df4
Former-commit-id: 20f5250a273d5660baba1c627f9e5dd86916a8e2
This commit is contained in:
iobyte 2022-07-09 15:41:15 +00:00
parent 136ec02761
commit 60f50b52df
2 changed files with 16 additions and 8 deletions

View file

@ -186,7 +186,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
tdble x, y, z;
tdble al, alfl;
tdble x1, x2, y1, y2;
tdble w, sw, ew, bw;
tdble sw, ew, bw;
tdble minWidth;
tdble maxWidth;
int type;
@ -207,9 +207,13 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
if (curStep == 0) {
/* Side parameters */
snprintf(path2, sizeof(path2), "%s/%s", path, SectSide[side]);
sw = GfParmGetNum(TrackHandle, path2, TRK_ATT_SWIDTH, (char*)NULL, sideEndWidth[side]);
w = GfParmGetNum(TrackHandle, path2, TRK_ATT_WIDTH, (char*)NULL, sw);
ew = GfParmGetNum(TrackHandle, path2, TRK_ATT_EWIDTH, (char*)NULL, w);
// use TRK_ATT_WIDTH if it exists
if (GfParmExistsParam(TrackHandle, path2, TRK_ATT_WIDTH)) {
sw = ew = GfParmGetNum(TrackHandle, path2, TRK_ATT_WIDTH, (char *)NULL, 0.0);
} else {
sw = GfParmGetNum(TrackHandle, path2, TRK_ATT_SWIDTH, (char *)NULL, sideEndWidth[side]);
ew = GfParmGetNum(TrackHandle, path2, TRK_ATT_EWIDTH, (char *)NULL, sw);
}
sideStartWidth[side] = sw;
sideEndWidth[side] = ew;
sideMaterial[side] = GfParmGetStr(TrackHandle, path2, TRK_ATT_SURF, sideMaterial[side]);

View file

@ -211,7 +211,7 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
tdble x, y, z;
tdble al, alfl;
tdble x1, x2, y1, y2;
tdble w, sw, ew, bw;
tdble sw, ew, bw;
tdble minWidth;
tdble maxWidth;
int type;
@ -232,9 +232,13 @@ AddSides(tTrackSeg *curSeg, void *TrackHandle, tTrack *theTrack, int curStep, in
if (curStep == 0) {
/* Side parameters */
snprintf(path2, sizeof(path2), "%s/%s", path, SectSide[side]);
sw = GfParmGetNum(TrackHandle, path2, TRK_ATT_SWIDTH, (char*)NULL, sideEndWidth[side]);
w = GfParmGetNum(TrackHandle, path2, TRK_ATT_WIDTH, (char*)NULL, sw);
ew = GfParmGetNum(TrackHandle, path2, TRK_ATT_EWIDTH, (char*)NULL, w);
// use TRK_ATT_WIDTH if it exists
if (GfParmExistsParam(TrackHandle, path2, TRK_ATT_WIDTH)) {
sw = ew = GfParmGetNum(TrackHandle, path2, TRK_ATT_WIDTH, (char *)NULL, 0.0);
} else {
sw = GfParmGetNum(TrackHandle, path2, TRK_ATT_SWIDTH, (char *)NULL, sideEndWidth[side]);
ew = GfParmGetNum(TrackHandle, path2, TRK_ATT_EWIDTH, (char *)NULL, sw);
}
sideStartWidth[side] = sw;
sideEndWidth[side] = ew;
sideMaterial[side] = GfParmGetStr(TrackHandle, path2, TRK_ATT_SURF, sideMaterial[side]);