manuel.gysin Posted April 7, 2011 Share Posted April 7, 2011 Hello While a developer done some dirty things, we found a little "bug": If you run this code: ObjectTerrain terrain; terrain = add_editor(node_load("/samples/common/terrains/terrain_1.node")); terrain.getHeight(-10, -10) You get a engine crash with: Unigine fatal error engine/framework/Terrain.cpp:3301: float Terrain::getHeight(int, int) const: Assertion: 'x >= 0 && x < size_x && y >= 0 && y < size_y && "Terrain::getHeight(): bad point coordinates"' Shutdown Its totally clear that this call makes no sense, but its dangerous in some situation I think. A "return -1" would be easier to handle. :) Greets Manuel Link to comment
ulf.schroeter Posted April 7, 2011 Share Posted April 7, 2011 A "return -1" would be easier to handle. but would also require permanent runtime parameter checking which might be a bad idea performance-wise. Debug-build assertion seems to be the compromise Link to comment
manuel.gysin Posted April 8, 2011 Author Share Posted April 8, 2011 In the view point of performance this is right. Wrote in the meantime a little check class which catch negative values and values bigger then x, y of the terrain. (if the value is bigger it too raise a crash) I think thats enough for our use case to be sure a crash can not happen. Link to comment
Recommended Posts