[Scummvm-cvs-logs] scummvm master -> 56664d036fa5ad1ef405fb4b019ef71d97baf427

Strangerke Strangerke at scummvm.org
Sun Feb 9 20:07:38 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
56664d036f HOPKINS: Reduce the scope of some more variables


Commit: 56664d036fa5ad1ef405fb4b019ef71d97baf427
    https://github.com/scummvm/scummvm/commit/56664d036fa5ad1ef405fb4b019ef71d97baf427
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-09T11:06:08-08:00

Commit Message:
HOPKINS: Reduce the scope of some more variables

Changed paths:
    engines/hopkins/lines.cpp
    engines/hopkins/objects.cpp



diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index aa708fd..e849f86 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;
 
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 347a6aa..2c780dd 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -376,7 +376,6 @@ void ObjectsManager::addObject(int objIndex) {
 void ObjectsManager::displaySprite() {
 	int clipX;
 	int clipY;
-	bool loopCondFl;
 	uint16 arr[50];
 
 	// Handle copying any background areas that text are going to be drawn on
@@ -441,6 +440,7 @@ void ObjectsManager::displaySprite() {
 		for (int i = 1; i <= 48; i++)
 			arr[i] = i;
 
+		bool loopCondFl;
 		do {
 			loopCondFl = false;
 			for (int sortIdx = 1; sortIdx < _sortedDisplayCount; sortIdx++) {
@@ -3613,12 +3613,10 @@ void ObjectsManager::showSpecialActionAnimation(const byte *spriteData, const Co
 		realSpeed = speed / 3;
 
 	int spriteIndex = 0;
-	bool completeTokenFl;
-	char nextChar;
 
 	for (int idx = 0; ; idx++) {
-		completeTokenFl = false;
-		nextChar = animString[idx];
+		bool completeTokenFl = false;
+		char nextChar = animString[idx];
 		if (nextChar == ',') {
 			spriteIndex = atoi(tmpStr.c_str());
 			tmpStr = "";






More information about the Scummvm-git-logs mailing list