aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-04-21 00:00:19 +0200
committerStrangerke2013-04-21 00:00:54 +0200
commitbe0f082ab60b638ec0780e6d748dfe7753299a51 (patch)
tree12288c2d7b58cc3a0f34e1f7ae5d028cd11839f6 /engines
parentf279cc0e514f0b521a43604be66de945f060c528 (diff)
downloadscummvm-rg350-be0f082ab60b638ec0780e6d748dfe7753299a51.tar.gz
scummvm-rg350-be0f082ab60b638ec0780e6d748dfe7753299a51.tar.bz2
scummvm-rg350-be0f082ab60b638ec0780e6d748dfe7753299a51.zip
HOPKINS: Improve test on lineData in testLine. CID 1003821
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/lines.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index 379405b570..3fe72d83b0 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -2440,21 +2440,22 @@ int LinesManager::testLine(int paramX, int paramY, int *testValue, int *foundLin
for (int idx = _lastLine + 1; idx < _linesNumb + 1; idx++) {
lineData = _lineItem[idx]._lineData;
lineDataEndIdx = _lineItem[idx]._lineDataEndIdx;
- if (lineData) {
- if (lineData[0] == paramX && lineData[1] == paramY) {
- *testValue = 1;
- int posX = lineData[2 * (lineDataEndIdx - 1)];
- int posY = lineData[2 * (lineDataEndIdx - 1) + 1];
- if (_lineItem[idx]._directionRouteInc == DIR_DOWN || _lineItem[idx]._directionRouteInc == DIR_UP)
- posY += 2;
- if (_lineItem[idx]._directionRouteInc == DIR_RIGHT || _lineItem[idx]._directionRouteDec == DIR_LEFT)
- posX += 2;
- if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine))
- error("Error in test line");
- *foundLineIdx = collLineIdx;
- *foundDataIdx = collDataIdx;
- return idx;
- }
+ if (!lineData)
+ continue;
+
+ if (lineData[0] == paramX && lineData[1] == paramY) {
+ *testValue = 1;
+ int posX = lineData[2 * (lineDataEndIdx - 1)];
+ int posY = lineData[2 * (lineDataEndIdx - 1) + 1];
+ if (_lineItem[idx]._directionRouteInc == DIR_DOWN || _lineItem[idx]._directionRouteInc == DIR_UP)
+ posY += 2;
+ if (_lineItem[idx]._directionRouteInc == DIR_RIGHT || _lineItem[idx]._directionRouteDec == DIR_LEFT)
+ posX += 2;
+ if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine))
+ error("Error in test line");
+ *foundLineIdx = collLineIdx;
+ *foundDataIdx = collDataIdx;
+ return idx;
}
if (lineDataEndIdx > 0) {