aboutsummaryrefslogtreecommitdiff
path: root/engines/toon/character.cpp
diff options
context:
space:
mode:
authorD G Turner2012-06-14 21:02:44 +0100
committerD G Turner2012-06-14 21:02:44 +0100
commitacaf8f762382f1aa886d4a3f5b0b8b662863f01c (patch)
tree92343acad27e1809445337bf7571e063a9558009 /engines/toon/character.cpp
parent57d34d2576d38a2820afeae0ba860dc863a34b08 (diff)
downloadscummvm-rg350-acaf8f762382f1aa886d4a3f5b0b8b662863f01c.tar.gz
scummvm-rg350-acaf8f762382f1aa886d4a3f5b0b8b662863f01c.tar.bz2
scummvm-rg350-acaf8f762382f1aa886d4a3f5b0b8b662863f01c.zip
TOON: Fix two latent off-by-one errors in Character Class.
These were exposed by assertions from Common::Array usage.
Diffstat (limited to 'engines/toon/character.cpp')
-rw-r--r--engines/toon/character.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index c9073de587..09730626f2 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -201,7 +201,7 @@ bool Character::walkTo(int16 newPosX, int16 newPosY) {
if (_blockingWalk) {
while ((_x != newPosX || _y != newPosY) && _currentPathNode < _currentPath.size() && !_vm->shouldQuitGame()) {
if (_currentPathNode < _currentPath.size() - 4) {
- int32 delta = MIN<int32>(4, _currentPath.size() - _currentPathNode);
+ int32 delta = MIN<int32>(4, _currentPath.size() - 1 - _currentPathNode);
int16 dx = _currentPath[_currentPathNode+delta].x - _x;
int16 dy = _currentPath[_currentPathNode+delta].y - _y;
@@ -348,7 +348,7 @@ void Character::update(int32 timeIncrement) {
if ((_flags & 0x1) && _currentPath.size() > 0) {
if (_currentPathNode < _currentPath.size()) {
if (_currentPathNode < _currentPath.size() - 10) {
- int32 delta = MIN<int32>(10, _currentPath.size() - _currentPathNode);
+ int32 delta = MIN<int32>(10, _currentPath.size() - 1 - _currentPathNode);
int16 dx = _currentPath[_currentPathNode+delta].x - _x;
int16 dy = _currentPath[_currentPathNode+delta].y - _y;
setFacing(getFacingFromDirection(dx, dy));