From b75da52cabd70ad89456e75e160e5b91ea3ac1e7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Feb 2014 00:42:35 +0100 Subject: TSAGE: R2R - Reduce the scope of some variables --- engines/tsage/ringworld2/ringworld2_logic.cpp | 4 ++-- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 6 +++--- engines/tsage/ringworld2/ringworld2_scenes2.cpp | 4 ++-- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'engines/tsage/ringworld2') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index b97f63bbd3..e81fce681c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -561,14 +561,14 @@ void SceneExt::saveCharacter(int characterIndex) { void SceneExt::scalePalette(int RFactor, int GFactor, int BFactor) { byte *tmpPal = R2_GLOBALS._scenePalette._palette; byte newR, newG, newB; - int tmp, varC, varD = 0; + int tmp, varD = 0; for (int i = 0; i < 256; i++) { newR = (RFactor * tmpPal[(3 * i)]) / 100; newG = (GFactor * tmpPal[(3 * i) + 1]) / 100; newB = (BFactor * tmpPal[(3 * i) + 2]) / 100; - varC = 769; + int varC = 769; for (int j = 255; j >= 0; j--) { tmp = abs(tmpPal[(3 * j)] - newR); if (tmp >= varC) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 1e6a5c2132..9475501bca 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -3913,8 +3913,6 @@ void Scene1337::Action10::signal() { void Scene1337::Action11::signal() { Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene; - bool noAction = true; - switch (_actionIndex++) { case 0: { scene->_actionCard2->_card.postInit(); @@ -3944,6 +3942,8 @@ void Scene1337::Action11::signal() { scene->_aSound1.play(57); bool found = false; + bool noAction = true; + int i = -1; switch (scene->_actionIdx2) { @@ -5411,10 +5411,10 @@ void Scene1337::showOptionsDialog() { } void Scene1337::handleClick(int arg1, Common::Point pt) { - bool found = false; int curReg = R2_GLOBALS._sceneRegions.indexOf(g_globals->_events._mousePos); if (arg1 == 3) { + bool found = false; int i; for (i = 0; i <= 7; i++) { if ( _gameBoardSide[2]._outpostStation[i].isIn(pt) diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index f928f3635c..ad9dbf5a98 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -4872,10 +4872,10 @@ void Scene2900::Map::drawBlock(const byte *data, int xp, int yp, void Scene2900::Map::moveArea(Rect &r, int xAmt, int yAmt) { Rect tempRect = r; tempRect.translate(xAmt, yAmt); - int xpSrc, xpDest, width; - int ypSrc, ypDest, height; if (tempRect.intersects(r)) { + int xpSrc, xpDest, width; + int ypSrc, ypDest, height; if (xAmt >= 0) { xpSrc = tempRect.left; width = tempRect.width() - xAmt; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index f2bb68480d..8b235f3575 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3896,7 +3896,6 @@ void Scene3500::dispatch() { int16 mazePosY = 0; int deltaX = 0; int deltaY = 0; - int tmpCellId = 0; int cellId = 0; if ((_mazeChangeAmount == 0) && !_postFixupFl) { @@ -3912,7 +3911,7 @@ void Scene3500::dispatch() { mazePosY = _mazeUI.cellFromY(_mazePosition.y + 46) - 46; deltaX = abs(mazePosX - newMazeX); deltaY = abs(mazePosY - newMazeY); - tmpCellId = 0; + int tmpCellId = 0; switch (_mazeDirection) { case MAZEDIR_NORTH: -- cgit v1.2.3