From 56664d036fa5ad1ef405fb4b019ef71d97baf427 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Feb 2014 20:06:08 +0100 Subject: HOPKINS: Reduce the scope of some more variables --- engines/hopkins/lines.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'engines/hopkins/lines.cpp') diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index aa708fdfb2..e849f8635c 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -548,8 +548,6 @@ int LinesManager::avoidObstacleOnSegment(int lineIdx, int lineDataIdx, int route bool LinesManager::MIRACLE(int fromX, int fromY, int lineIdx, int destLineIdx, int routeIdx) { debugC(5, kDebugPath, "MIRACLE(%d, %d, %d, %d, %d)", fromX, fromY, lineIdx, destLineIdx, routeIdx); - int newLinesDataIdx = 0; - int newLinesIdx = 0; int lineIdxLeft = 0; int lineDataIdxLeft = 0; int lineIdxRight = 0; @@ -700,6 +698,8 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int lineIdx, int destLineIdx, i newDir = DIR_LEFT; } + int newLinesDataIdx = 0; + int newLinesIdx = 0; switch(newDir) { case DIR_UP: newLinesIdx = linesIdxUp; @@ -1552,7 +1552,6 @@ void LinesManager::useRoute2(int idx, int curRouteIdx) { int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int startLineIdx, int endLineIdx, int routeIdx) { debugC(5, kDebugPath, "characterRoute(%d, %d, %d, %d, %d, %d, %d)", fromX, fromY, destX, destY, startLineIdx, endLineIdx, routeIdx); int collDataIdxRoute2 = 0; - bool colResult = false; int curX = fromX; int curY = fromY; @@ -1603,7 +1602,6 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int int collLineIdxRoute1 = -1; int collLineIdxRoute2 = -1; - int distX, distY; int repeatFlag = 0; int collDataIdxRoute0 = 0; int collDataIdxRoute1 = 0; @@ -1615,8 +1613,8 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int useRoute0(idxRoute0, curRouteIdx); return 1; } - distX = abs(curX - destX) + 1; - distY = abs(curY - destY) + 1; + int distX = abs(curX - destX) + 1; + int distY = abs(curY - destY) + 1; int maxDist; if (distX > distY) maxDist = distX; @@ -1912,7 +1910,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int posXRoute2 = _newPosX; posYRoute2 = _newPosY; - colResult = checkCollisionLine(_newPosX, _newPosY, &collDataIdxRoute2, &collLineIdxRoute2, 0, _lastLine); + bool colResult = checkCollisionLine(_newPosX, _newPosY, &collDataIdxRoute2, &collLineIdxRoute2, 0, _lastLine); if (colResult && collLineIdxRoute2 <= _lastLine) break; } @@ -2456,13 +2454,12 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int superRouteIdx, int para int LinesManager::testLine(int paramX, int paramY, int *testValue, int *foundLineIdx, int *foundDataIdx) { debugC(5, kDebugPath, "testLine(%d, %d, testValue, foundLineIdx, foundDataIdx)", paramX, paramY); int16 *lineData; - int lineDataEndIdx; int collLineIdx; int collDataIdx; for (int idx = _lastLine + 1; idx < _linesNumb + 1; idx++) { lineData = _lineItem[idx]._lineData; - lineDataEndIdx = _lineItem[idx]._lineDataEndIdx; + int lineDataEndIdx = _lineItem[idx]._lineDataEndIdx; if (!lineData) continue; -- cgit v1.2.3