Fix for google code Issue 209

- fixed clamping if indices used in getHeight()
This commit is contained in:
Mikko Mononen 2013-09-19 20:26:22 +02:00
parent 991c08f222
commit f6b11b18a9

View File

@ -200,8 +200,8 @@ static unsigned short getHeight(const float fx, const float fy, const float fz,
{
int ix = (int)floorf(fx*ics + 0.01f);
int iz = (int)floorf(fz*ics + 0.01f);
ix = rcClamp(ix-hp.xmin, 0, hp.width);
iz = rcClamp(iz-hp.ymin, 0, hp.height);
ix = rcClamp(ix-hp.xmin, 0, hp.width - 1);
iz = rcClamp(iz-hp.ymin, 0, hp.height - 1);
unsigned short h = hp.data[ix+iz*hp.width];
if (h == RC_UNSET_HEIGHT)
{