trackgen: check type before casting
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8497 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 6e6aa61eb3fb338ebc90a9ca27ea0fdabd8e6752 Former-commit-id: 266e477c0a280f0f6c02de3d632113397546086a
This commit is contained in:
parent
966d295429
commit
5b10d5c771
1 changed files with 13 additions and 9 deletions
|
@ -344,15 +344,13 @@ struct saveTriangle
|
|||
sgVec2 t[3];
|
||||
};
|
||||
|
||||
static int
|
||||
ssgSaveLeaf (ssgEntity *ent, FILE *save_fd)
|
||||
static bool
|
||||
ssgSaveLeaf (ssgLeaf* vt, FILE *save_fd)
|
||||
{
|
||||
int i;
|
||||
static sgVec3 *vlist;
|
||||
static saveTriangle *tlist;
|
||||
|
||||
ssgLeaf *vt = (ssgLeaf *)ent;
|
||||
|
||||
int num_verts = vt->getNumVertices();
|
||||
int num_tris = vt->getNumTriangles();
|
||||
|
||||
|
@ -448,10 +446,10 @@ ssgSaveLeaf (ssgEntity *ent, FILE *save_fd)
|
|||
delete[] vlist;
|
||||
delete[] tlist;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int
|
||||
static bool
|
||||
ssgSaveACInner (ssgEntity *ent, FILE *save_fd)
|
||||
{
|
||||
/* WARNING - RECURSIVE! */
|
||||
|
@ -466,14 +464,20 @@ ssgSaveACInner (ssgEntity *ent, FILE *save_fd)
|
|||
{
|
||||
if (! ssgSaveACInner(br->getKid (i), save_fd))
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else if (ent->isAKindOf(ssgTypeLeaf()))
|
||||
{
|
||||
ssgLeaf* vt = (ssgLeaf *)ent;
|
||||
|
||||
return ssgSaveLeaf(vt, save_fd);
|
||||
}
|
||||
|
||||
return ssgSaveLeaf (ent, save_fd);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* insert one leaf in group */
|
||||
|
|
Loading…
Reference in a new issue