aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/map.cpp
diff options
context:
space:
mode:
authorSven Hesse2010-10-25 03:38:12 +0000
committerSven Hesse2010-10-25 03:38:12 +0000
commit27cfa212300c6c122e4740fbf8f62bfc8c05f6f0 (patch)
tree26274f87209ff9a1dcd655e1b4f502dc36659af8 /engines/gob/map.cpp
parent029aee61a6741e10159042895b5e62f2cbf5b925 (diff)
downloadscummvm-rg350-27cfa212300c6c122e4740fbf8f62bfc8c05f6f0.tar.gz
scummvm-rg350-27cfa212300c6c122e4740fbf8f62bfc8c05f6f0.tar.bz2
scummvm-rg350-27cfa212300c6c122e4740fbf8f62bfc8c05f6f0.zip
GOB: Fix a typo in checkDirectPath()
svn-id: r53790
Diffstat (limited to 'engines/gob/map.cpp')
-rw-r--r--engines/gob/map.cpp18
1 files changed, 9 insertions, 9 deletions
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))