diff options
author | David Turner | 2011-01-13 20:06:23 +0000 |
---|---|---|
committer | David Turner | 2011-01-13 20:06:23 +0000 |
commit | 460f8c277b3b40b2fadbb9523fa1dfc502555979 (patch) | |
tree | b5c5ef0cd41fbac568dc7add6b9aa2b5aad8c752 | |
parent | 75a2c36ecd9ff0f9dc268166b908450c7c6b90b2 (diff) | |
download | scummvm-rg350-460f8c277b3b40b2fadbb9523fa1dfc502555979.tar.gz scummvm-rg350-460f8c277b3b40b2fadbb9523fa1dfc502555979.tar.bz2 scummvm-rg350-460f8c277b3b40b2fadbb9523fa1dfc502555979.zip |
PARALLACTION: Fixed Limit Values in Big Red Adventure Walker Code.
This corrects the Valgrind invalid reads associated with the IS_PATH_CLEAR() check reading beyond the data buffer and probably improves the pathfinding behaviour.
Thanks to fuzzie for suggesting this patch.
svn-id: r55231
-rw-r--r-- | engines/parallaction/walk.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index 3fa71d7a27..7efc1a1e4c 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -656,7 +656,7 @@ void PathWalker_BR::doWalk(State &s) { Common::Point p(*s._walkPath.begin()); - if (s._startFoot.y < p.y && s._startFoot.y < maxY && IS_PATH_CLEAR(s._startFoot.x, yStep + s._startFoot.y)) { + if (s._startFoot.y < p.y && (s._startFoot.y + yStep) < maxY && IS_PATH_CLEAR(s._startFoot.x, s._startFoot.y + yStep)) { if (yStep + s._startFoot.y <= p.y) { s._fieldC = 1; delta.y = yStep; @@ -667,7 +667,7 @@ void PathWalker_BR::doWalk(State &s) { } s._dirFrame = 9; } else - if (s._startFoot.y > p.y && s._startFoot.y > minY && IS_PATH_CLEAR(s._startFoot.x, s._startFoot.y - yStep)) { + if (s._startFoot.y > p.y && (s._startFoot.y - yStep) > minY && IS_PATH_CLEAR(s._startFoot.x, s._startFoot.y - yStep)) { if (s._startFoot.y - yStep >= p.y) { s._fieldC = 1; delta.y = yStep; @@ -679,7 +679,7 @@ void PathWalker_BR::doWalk(State &s) { s._dirFrame = 0; } - if (s._startFoot.x < p.x && s._startFoot.x < maxX && IS_PATH_CLEAR(s._startFoot.x + xStep, s._startFoot.y)) { + if (s._startFoot.x < p.x && (s._startFoot.x + xStep) < maxX && IS_PATH_CLEAR(s._startFoot.x + xStep, s._startFoot.y)) { if (s._startFoot.x + xStep <= p.x) { s._fieldC = 1; delta.x = xStep; @@ -692,7 +692,7 @@ void PathWalker_BR::doWalk(State &s) { s._dirFrame = 18; // right } } else - if (s._startFoot.x > p.x && s._startFoot.x > minX && IS_PATH_CLEAR(s._startFoot.x - xStep, s._startFoot.y)) { + if (s._startFoot.x > p.x && (s._startFoot.x - xStep) > minX && IS_PATH_CLEAR(s._startFoot.x - xStep, s._startFoot.y)) { if (s._startFoot.x - xStep >= p.x) { s._fieldC = 1; delta.x = xStep; |