aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/walk.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2010-04-28 22:52:36 +0000
committerNicola Mettifogo2010-04-28 22:52:36 +0000
commit4cb1fc9e795d555826e1bd5e06320c329d73f30c (patch)
treeb2b9127f4f0c67194d8865fc12dd50234397598f /engines/parallaction/walk.cpp
parent9001a8fbc3429d4104f946322d306cbaef5f0965 (diff)
downloadscummvm-rg350-4cb1fc9e795d555826e1bd5e06320c329d73f30c.tar.gz
scummvm-rg350-4cb1fc9e795d555826e1bd5e06320c329d73f30c.tar.bz2
scummvm-rg350-4cb1fc9e795d555826e1bd5e06320c329d73f30c.zip
Make sure walk coordinate are valid before checking path buffer.
svn-id: r48846
Diffstat (limited to 'engines/parallaction/walk.cpp')
-rw-r--r--engines/parallaction/walk.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp
index f20d4af7a7..8fc916e490 100644
--- a/engines/parallaction/walk.cpp
+++ b/engines/parallaction/walk.cpp
@@ -73,10 +73,10 @@ void PathWalker_NS::correctPathPoint(Common::Point &to) {
int16 left = to.x;
do {
right++;
- } while (!IS_PATH_CLEAR(right, to.y) && (right < maxX));
+ } while ((right < maxX) && !IS_PATH_CLEAR(right, to.y));
do {
left--;
- } while (!IS_PATH_CLEAR(left, to.y) && (left > 0));
+ } while ((left > 0) && !IS_PATH_CLEAR(left, to.y));
right = (right == maxX) ? 1000 : right - to.x;
left = (left == 0) ? 1000 : to.x - left;
@@ -85,10 +85,10 @@ void PathWalker_NS::correctPathPoint(Common::Point &to) {
int16 bottom = to.y;
do {
top--;
- } while (!IS_PATH_CLEAR(to.x, top) && (top > 0));
+ } while ((top > 0) && !IS_PATH_CLEAR(to.x, top));
do {
bottom++;
- } while (!IS_PATH_CLEAR(to.x, bottom) && (bottom < maxY));
+ } while ((bottom < maxY) && !IS_PATH_CLEAR(to.x, bottom) );
top = (top == 0) ? 1000 : to.y - top;
bottom = (bottom == maxY) ? 1000 : bottom - to.y;