trackgen: make global variable TrackRoot local

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

Former-commit-id: f644368b6b03fc7f40fd3e4309bd327546ea20bb
Former-commit-id: dd4277417276626651889c308a7a5c99c9a4bb2a
This commit is contained in:
iobyte 2022-09-12 15:07:18 +00:00
parent 45a53ebded
commit 6340a2f608

View file

@ -50,7 +50,6 @@ static char buf[1024];
static ssgRoot *Root = nullptr; static ssgRoot *Root = nullptr;
static ssgRoot *GroupRoot = nullptr; static ssgRoot *GroupRoot = nullptr;
static ssgRoot *TrackRoot = nullptr;
struct group struct group
{ {
@ -261,7 +260,7 @@ AddToRoot(ssgEntity *node)
} }
static void static void
AddObject(tTrack *track, void *TrackHandle, unsigned int clr, tdble x, tdble y) AddObject(tTrack *track, void *TrackHandle, ssgRoot *TrackRoot, unsigned int clr, tdble x, tdble y)
{ {
for (struct objdef *curObj = GF_TAILQ_FIRST(&objhead); curObj; curObj = GF_TAILQ_NEXT(curObj, link)) for (struct objdef *curObj = GF_TAILQ_FIRST(&objhead); curObj; curObj = GF_TAILQ_NEXT(curObj, link))
{ {
@ -577,7 +576,7 @@ GenerateObjects(tTrack *track, void *TrackHandle, void *CfgHandle, FILE *save_fd
ssgTexturePath(buf); ssgTexturePath(buf);
snprintf(buf, sizeof(buf), ".;%s;%sdata/objects", inputPath.c_str(), GfDataDir()); snprintf(buf, sizeof(buf), ".;%s;%sdata/objects", inputPath.c_str(), GfDataDir());
ssgModelPath(""); // don't need a search path because meshFile has a full path ssgModelPath(""); // don't need a search path because meshFile has a full path
TrackRoot = (ssgRoot*)ssgLoadAC(meshFile.c_str()); ssgRoot *TrackRoot = (ssgRoot*)ssgLoadAC(meshFile.c_str());
InitObjects(track, TrackHandle); InitObjects(track, TrackHandle);
@ -628,7 +627,7 @@ GenerateObjects(tTrack *track, void *TrackHandle, void *CfgHandle, FILE *save_fd
if (clr) if (clr)
{ {
printf("found color: 0x%X x: %d y: %d\n", clr, i, j); printf("found color: 0x%X x: %d y: %d\n", clr, i, j);
AddObject(track, TrackHandle, clr, i * kX + dX, j * kY + dY); AddObject(track, TrackHandle, TrackRoot, clr, i * kX + dX, j * kY + dY);
} }
} }
} }