Fix crashes and odd behaviour in RecastDemo on geometry load failure
Would crash if selecting a test with geometry then a test with missing geometry Would use the previous sample type if selecting a sample that doesn't exist in the list Two of the test cases had an incorrect sample name
This commit is contained in:
parent
cc35cd8126
commit
f44e151556
@ -1,4 +1,4 @@
|
||||
s Solo Mesh Simple
|
||||
s Solo Mesh
|
||||
f movement.obj
|
||||
pf -100.539185 -1.000000 54.028996 62.582016 15.757828 52.842243 0x3 0x0
|
||||
pf -100.539185 -1.000000 54.028996 -1.259964 -1.000000 50.116970 0x3 0x0
|
||||
|
@ -1,4 +1,4 @@
|
||||
s Solo Mesh Simple
|
||||
s Solo Mesh
|
||||
f nav_test.obj
|
||||
pf 18.138550 -2.370003 -21.319118 -19.206181 -2.369133 24.802742 0x3 0x0
|
||||
pf 18.252758 -2.368240 -7.000238 -19.206181 -2.369133 24.802742 0x3 0x0
|
||||
|
@ -66,7 +66,6 @@ static SampleItem g_samples[] =
|
||||
{ createSolo, "Solo Mesh" },
|
||||
{ createTile, "Tile Mesh" },
|
||||
{ createTempObstacle, "Temp Obstacles" },
|
||||
// { createDebug, "Debug" },
|
||||
};
|
||||
static const int g_nsamples = sizeof(g_samples) / sizeof(SampleItem);
|
||||
|
||||
@ -626,7 +625,7 @@ int main(int /*argc*/, char** /*argv*/)
|
||||
delete sample;
|
||||
sample = newSample;
|
||||
sample->setContext(&ctx);
|
||||
if (geom && sample)
|
||||
if (geom)
|
||||
{
|
||||
sample->handleMeshChanged(geom);
|
||||
}
|
||||
@ -695,6 +694,13 @@ int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
delete geom;
|
||||
geom = 0;
|
||||
|
||||
// Destroy the sample if it already had geometry loaded, as we've just deleted it!
|
||||
if (sample && sample->getInputGeom())
|
||||
{
|
||||
delete sample;
|
||||
sample = 0;
|
||||
}
|
||||
|
||||
showLog = true;
|
||||
logScroll = 0;
|
||||
@ -778,10 +784,12 @@ int main(int /*argc*/, char** /*argv*/)
|
||||
sampleName = g_samples[i].name;
|
||||
}
|
||||
}
|
||||
if (newSample)
|
||||
|
||||
delete sample;
|
||||
sample = newSample;
|
||||
|
||||
if (sample)
|
||||
{
|
||||
delete sample;
|
||||
sample = newSample;
|
||||
sample->setContext(&ctx);
|
||||
showSample = false;
|
||||
}
|
||||
@ -789,16 +797,17 @@ int main(int /*argc*/, char** /*argv*/)
|
||||
// Load geom.
|
||||
meshName = test->getGeomFileName();
|
||||
|
||||
delete geom;
|
||||
geom = 0;
|
||||
|
||||
path = meshesFolder + "/" + meshName;
|
||||
|
||||
delete geom;
|
||||
geom = new InputGeom;
|
||||
if (!geom || !geom->load(&ctx, path))
|
||||
{
|
||||
delete geom;
|
||||
geom = 0;
|
||||
delete sample;
|
||||
sample = 0;
|
||||
showLog = true;
|
||||
logScroll = 0;
|
||||
ctx.dumpLog("Geom load log %s:", meshName.c_str());
|
||||
|
Loading…
x
Reference in New Issue
Block a user