diff options
| author | Sven Hesse | 2010-10-25 03:39:04 +0000 |
|---|---|---|
| committer | Sven Hesse | 2010-10-25 03:39:04 +0000 |
| commit | f1d41b83264576beaa82e98a5dfef3663020f1ef (patch) | |
| tree | 41b8151a7bf053ebbbcb40dc656fc47355405505 | |
| parent | bcb85799540b946ac4c48abe7f3842e6b9a6fde1 (diff) | |
| download | scummvm-rg350-f1d41b83264576beaa82e98a5dfef3663020f1ef.tar.gz scummvm-rg350-f1d41b83264576beaa82e98a5dfef3663020f1ef.tar.bz2 scummvm-rg350-f1d41b83264576beaa82e98a5dfef3663020f1ef.zip | |
GOB: Format optimizePoints() to be a bit more readable
svn-id: r53792
| -rw-r--r-- | engines/gob/map_v2.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/engines/gob/map_v2.cpp b/engines/gob/map_v2.cpp index e2f9207003..83f02bb69b 100644 --- a/engines/gob/map_v2.cpp +++ b/engines/gob/map_v2.cpp @@ -258,17 +258,24 @@ void Map_v2::findNearestToDest(Mult::Mult_Object *obj) { void Map_v2::optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y) { if (obj->nearestWayPoint < obj->nearestDest) { + for (int i = obj->nearestWayPoint; i <= obj->nearestDest; i++) { if (checkDirectPath(obj, x, y, _wayPoints[i].x, _wayPoints[i].y) == 1) obj->nearestWayPoint = i; } + } else { - for (int i = obj->nearestWayPoint; - i >= obj->nearestDest && (_wayPoints[i].notWalkable != 1); i--) { + + for (int i = obj->nearestWayPoint; i >= obj->nearestDest; i++) { + if (_wayPoints[i].notWalkable == 1) + break; + if (checkDirectPath(obj, x, y, _wayPoints[i].x, _wayPoints[i].y) == 1) obj->nearestWayPoint = i; } + } + } } // End of namespace Gob |
