[Scummvm-cvs-logs] SF.net SVN: scummvm:[55231] scummvm/trunk/engines/parallaction/walk.cpp
tdhs at users.sourceforge.net
tdhs at users.sourceforge.net
Thu Jan 13 21:06:24 CET 2011
Revision: 55231
http://scummvm.svn.sourceforge.net/scummvm/?rev=55231&view=rev
Author: tdhs
Date: 2011-01-13 20:06:23 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
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.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/walk.cpp
Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp 2011-01-13 19:30:00 UTC (rev 55230)
+++ scummvm/trunk/engines/parallaction/walk.cpp 2011-01-13 20:06:23 UTC (rev 55231)
@@ -656,7 +656,7 @@
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 @@
}
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 @@
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 @@
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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list