Fix for issue 174.

This commit is contained in:
Mikko Mononen 2011-07-03 11:49:16 +00:00
parent d5729c678b
commit c4f95ec7e2

View File

@ -38,6 +38,7 @@ void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb
{ {
rcSpan* ps = 0; rcSpan* ps = 0;
bool previousWalkable = false; bool previousWalkable = false;
unsigned char previousArea = RC_NULL_AREA;
for (rcSpan* s = solid.spans[x + y*w]; s; ps = s, s = s->next) for (rcSpan* s = solid.spans[x + y*w]; s; ps = s, s = s->next)
{ {
@ -47,11 +48,12 @@ void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb
if (!walkable && previousWalkable) if (!walkable && previousWalkable)
{ {
if (rcAbs((int)s->smax - (int)ps->smax) <= walkableClimb) if (rcAbs((int)s->smax - (int)ps->smax) <= walkableClimb)
s->area = RC_NULL_AREA; s->area = previousArea;
} }
// Copy walkable flag so that it cannot propagate // Copy walkable flag so that it cannot propagate
// past multiple non-walkable objects. // past multiple non-walkable objects.
previousWalkable = walkable; previousWalkable = walkable;
previousArea = s->area;
} }
} }
} }