BaldrDash / recastnavigation

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

Invalid salt calculation with one Tile and Poly #162

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a NavMesh with one tile with one polygon.
2. Create a query with this NavMesh.
3. Call query->getPath() with some meaningful values.

What is the expected output? What do you see instead?

He should output a path over the polygon but instead returns an error because 
the decoded salt of the PolyId "1" is "0" where it should be "1".

What version of the product are you using? On what operating system?

At least the latest three revisions from trunk. (VS2005)

Please provide any additional information below.

I´m not exactly sure whats the reason. My guess is that the saltMask in 
"decodePolyId" is not valid in this case.

Original issue reported on code.google.com by xadhoom...@googlemail.com on 9 Feb 2011 at 4:39

GoogleCodeExporter commented 9 years ago
Fixed in R274. The problem was that in case there is only one polygon, the tile 
and poly bits are 0, and saltBits becomes 32. This will cause problems when 
calculating the saltMask using 32 bit uint:

        const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;

There was earlier request to allow 0 polyMask, so I clamped saltBits to 31. 
Should be enough for everyone.

Original comment by memono...@gmail.com on 9 Feb 2011 at 6:54