From 27cfa212300c6c122e4740fbf8f62bfc8c05f6f0 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 25 Oct 2010 03:38:12 +0000 Subject: GOB: Fix a typo in checkDirectPath() svn-id: r53790 --- engines/gob/map.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/gob/map.cpp b/engines/gob/map.cpp index dc0f9d4e20..dcd22bcc8b 100644 --- a/engines/gob/map.cpp +++ b/engines/gob/map.cpp @@ -352,20 +352,20 @@ void Map::findNearestWalkable(int16 &gobDestX, int16 &gobDestY, int16 Map::checkDirectPath(Mult::Mult_Object *obj, int16 x0, int16 y0, int16 x1, int16 y1) { - uint16 dir; while (1) { - dir = getDirection(x0, y0, x1, y1); + uint16 dir = getDirection(x0, y0, x1, y1); if (obj) { - if (obj->nearestWayPoint < obj->nearestDest) { - if (_wayPoints[obj->nearestWayPoint + 1].notWalkable == 1) - return 3; - } else if (obj->nearestWayPoint > obj->nearestDest) { - if (obj->nearestDest > 0) - if (_wayPoints[obj->nearestDest - 1].notWalkable == 1) + if (obj->nearestWayPoint < obj->nearestDest) + if ((obj->nearestWayPoint + 1) < _wayPointsCount) + if (_wayPoints[obj->nearestWayPoint + 1].notWalkable == 1) + return 3; + + if (obj->nearestWayPoint > obj->nearestDest) + if (obj->nearestWayPoint > 0) + if (_wayPoints[obj->nearestWayPoint - 1].notWalkable == 1) return 3; - } } if ((x0 == x1) && (y0 == y1)) -- cgit v1.2.3