Improve error handling

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10586 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2012-01-07 23:07:37 +00:00
parent ca4da84bae
commit d731420997

View File

@ -101,10 +101,17 @@ void TriangleMesh::createCollisionShape(bool create_collision_object, const char
fclose(f); fclose(f);
btOptimizedBvh* bhv = btOptimizedBvh::deSerializeInPlace(bytes, pos, !IS_LITTLE_ENDIAN); btOptimizedBvh* bhv = btOptimizedBvh::deSerializeInPlace(bytes, pos, !IS_LITTLE_ENDIAN);
bhv_triangle_mesh = new btBvhTriangleMeshShape(&m_mesh, true /* useQuantizedAabbCompression */, if (bhv == NULL)
false /* buildBvh */); {
bhv_triangle_mesh->setOptimizedBvh( bhv ); fprintf(stderr, "[TriangleMesh] WARNING, failed to load serialized BHV");
bhv_triangle_mesh = new btBvhTriangleMeshShape(&m_mesh, true /* useQuantizedAabbCompression */);
}
else
{
bhv_triangle_mesh = new btBvhTriangleMeshShape(&m_mesh, true /* useQuantizedAabbCompression */,
false /* buildBvh */);
bhv_triangle_mesh->setOptimizedBvh( bhv );
}
// Do *NOT* free the bytes, 'deSerializeInPlace' makes the btOptimizedBvh object // Do *NOT* free the bytes, 'deSerializeInPlace' makes the btOptimizedBvh object
// directly at this memory location // directly at this memory location
//free(bytes); //free(bytes);