aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins
diff options
context:
space:
mode:
authorStrangerke2013-05-16 01:28:30 +0200
committerStrangerke2013-05-16 01:28:30 +0200
commit90084cfdce0b64b0631cd5428c4c6fc97eb99090 (patch)
treedb7bd6ef518c1392ee3dab599190958a224c64fc /engines/hopkins
parentc69b8fbaf5bd8d4108d4bfb8ef97bca14ac0085a (diff)
downloadscummvm-rg350-90084cfdce0b64b0631cd5428c4c6fc97eb99090.tar.gz
scummvm-rg350-90084cfdce0b64b0631cd5428c4c6fc97eb99090.tar.bz2
scummvm-rg350-90084cfdce0b64b0631cd5428c4c6fc97eb99090.zip
HOPKINS: Fix bug #3611942 and #3613072 - Pathfinding regression in 1fd81eee4056342971220240a49baef73737b386
Diffstat (limited to 'engines/hopkins')
-rw-r--r--engines/hopkins/lines.cpp35
1 files changed, 16 insertions, 19 deletions
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index e6d5e5ca7f..14320d5442 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -945,46 +945,43 @@ int LinesManager::computeRouteIdx(int lineIdx, int dataIdx, int fromX, int fromY
if (destX >= minLineX && destX <= maxLineX && destY >= minLineY && destY <= maxLineY) {
int curY = destY;
int linesIdxUp = -1;
+ bool loopCond = false;
for (;;) {
--curY;
- if (!checkCollisionLine(destX, curY, &foundDataIdx, &foundLineIdx, startLineIdx, endLineIdx))
- break;
-
- linesIdxUp = foundLineIdx;
- if (!curY || minLineY > curY)
+ if (loopCond = checkCollisionLine(destX, curY, &foundDataIdx, &foundLineIdx, startLineIdx, endLineIdx))
+ linesIdxUp = foundLineIdx;
+ if (!curY || minLineY > curY || loopCond)
break;
}
curY = destY;
int lineIdxDown = -1;
+ loopCond = false;
for (;;) {
++curY;
- if (!checkCollisionLine(destX, curY, &foundDataIdx, &foundLineIdx, startLineIdx, endLineIdx))
- break;
-
- lineIdxDown = foundLineIdx;
- if (_vm->_globals->_characterMaxPosY <= curY || maxLineY <= curY)
+ if (loopCond = checkCollisionLine(destX, curY, &foundDataIdx, &foundLineIdx, startLineIdx, endLineIdx))
+ lineIdxDown = foundLineIdx;
+ if (_vm->_globals->_characterMaxPosY <= curY || maxLineY <= curY || loopCond)
break;
}
int curX = destX;
int lineIdxRight = -1;
+ loopCond = false;
for (;;) {
++curX;
- if (!checkCollisionLine(curX, destY, &foundDataIdx, &foundLineIdx, startLineIdx, endLineIdx))
- break;
-
- lineIdxRight = foundLineIdx;
+ if (loopCond = checkCollisionLine(curX, destY, &foundDataIdx, &foundLineIdx, startLineIdx, endLineIdx))
+ lineIdxRight = foundLineIdx;
- if (_vm->_graphicsMan->_maxX <= curX || maxLineX <= curX)
+ if (_vm->_graphicsMan->_maxX <= curX || maxLineX <= curX || loopCond)
break;
}
curX = destX;
int lineIdxLeft = -1;
+ loopCond = false;
for(;;) {
--curX;
- if (!checkCollisionLine(curX, destY, &foundDataIdx, &foundLineIdx, startLineIdx, endLineIdx))
- break;
- lineIdxLeft = foundLineIdx;
- if (curX <= 0 || minLineX >= curX)
+ if (loopCond = checkCollisionLine(curX, destY, &foundDataIdx, &foundLineIdx, startLineIdx, endLineIdx))
+ lineIdxLeft = foundLineIdx;
+ if (curX <= 0 || minLineX >= curX || loopCond)
break;
}
if (lineIdxRight != -1 && lineIdxLeft != -1 && linesIdxUp != -1 && lineIdxDown != -1) {