swordlegend / recastnavigation

Automatically exported from code.google.com/p/recastnavigation
zlib License
0 stars 0 forks source link

Interface recommendation #62

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In a lot of the interfaces you accept a ptr to an object, however the 
function implementation expects the object to be non-NULL. Would it make 
more sense to accept a reference?

static void drawMeshTile(duDebugDraw* dd, const dtNavMesh* mesh, const 
dtMeshTile* tile, unsigned char flags)

In the above function "dd", "mesh" and "tile" can not be NULL. Would the 
following be less error prone? (if only because it makes the function 
requirements clear to the client):

static void drawMeshTile(duDebugDraw& dd, const dtNavMesh& mesh, const 
dtMeshTile& tile, unsigned char flags)

Seems that the Recast debug draw functions are more like as I've described 
above.

Original issue reported on code.google.com by armstron...@gmail.com on 13 Apr 2010 at 10:29

GoogleCodeExporter commented 9 years ago

Original comment by memono...@gmail.com on 14 Apr 2010 at 6:49

GoogleCodeExporter commented 9 years ago
Changed the debug draw API to use references when data is assumed to be valid,
pointers are validated before used.

Fixed in R157.

Original comment by memono...@gmail.com on 15 Apr 2010 at 7:24