aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2014-06-06 22:49:21 +0200
committerStrangerke2014-06-06 22:49:21 +0200
commit8cb50b52e0e6614343419ca75803c8a18cf085df (patch)
treed4aa9af4bebe7b4ee526fb65f03094550ec5ca66
parent23abf274a7a2f3de00d1e203b3675785af3184d1 (diff)
downloadscummvm-rg350-8cb50b52e0e6614343419ca75803c8a18cf085df.tar.gz
scummvm-rg350-8cb50b52e0e6614343419ca75803c8a18cf085df.tar.bz2
scummvm-rg350-8cb50b52e0e6614343419ca75803c8a18cf085df.zip
CRUISE: Reduce the scope of some more variables
-rw-r--r--engines/cruise/linker.cpp8
-rw-r--r--engines/cruise/menu.cpp3
-rw-r--r--engines/cruise/object.cpp12
3 files changed, 8 insertions, 15 deletions
diff --git a/engines/cruise/linker.cpp b/engines/cruise/linker.cpp
index 7768e05585..9786de775f 100644
--- a/engines/cruise/linker.cpp
+++ b/engines/cruise/linker.cpp
@@ -129,8 +129,6 @@ int updateScriptImport(int ovlIdx) {
// do it for the 2 first string types
do {
- int i = 0;
-
if (param == 0) {
var_32 = numData3;
} else {
@@ -138,16 +136,16 @@ int updateScriptImport(int ovlIdx) {
}
if (var_32) {
+ int i = 0;
do {
importScriptStruct *ptrImportData;
const char *ptrImportName;
uint8 *ptrData;
- if (param == 0) {
+ if (param == 0)
pScript = getOvlData3Entry(ovlIdx, i);
- } else {
+ else
pScript = scriptFunc1Sub2(ovlIdx, i);
- }
ptrImportData = (importScriptStruct *)(pScript->dataPtr + pScript->offsetToImportData); // import data
ptrImportName = (const char*)(pScript->dataPtr + pScript->offsetToImportName); // import name
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index 8f162ee1ad..0a497202e2 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -233,7 +233,6 @@ static void handleSaveLoad(bool saveFlag) {
}
int playerMenu(int menuX, int menuY) {
- int retourMenu;
//int restartGame = 0;
if (playerMenuEnabled && displayOn) {
@@ -277,7 +276,7 @@ int playerMenu(int menuX, int menuY) {
addSelectableMenuEntry(0, 6, menuTable[0], 1, -1, _vm->langString(ID_RESTART));
addSelectableMenuEntry(0, 7, menuTable[0], 1, -1, _vm->langString(ID_QUIT));
- retourMenu = processMenu(menuTable[0]);
+ int retourMenu = processMenu(menuTable[0]);
freeMenu(menuTable[0]);
menuTable[0] = NULL;
diff --git a/engines/cruise/object.cpp b/engines/cruise/object.cpp
index 3e61ff4d7d..664627b9a4 100644
--- a/engines/cruise/object.cpp
+++ b/engines/cruise/object.cpp
@@ -116,14 +116,10 @@ int16 getMultipleObjectParam(int16 overlayIdx, int16 objectIdx, objectParamsQuer
}
void setObjectPosition(int16 ovlIdx, int16 objIdx, int16 param3, int16 param4) {
- objDataStruct *ptr;
- objectParams *ptr2;
-
- ptr = getObjectDataFromOverlay(ovlIdx, objIdx);
-
- if (!ptr) {
+ objDataStruct *ptr = getObjectDataFromOverlay(ovlIdx, objIdx);
+ if (!ptr)
return;
- }
+
//overlayTable[param1].ovlData
switch (ptr->_class) {
@@ -138,7 +134,7 @@ void setObjectPosition(int16 ovlIdx, int16 objIdx, int16 param3, int16 param4) {
case UNIQUE:
return;
case VARIABLE: {
- ptr2 = &overlayTable[ovlIdx].ovlData->arrayObjVar[ptr->_varTableIdx];
+ objectParams *ptr2 = &overlayTable[ovlIdx].ovlData->arrayObjVar[ptr->_varTableIdx];
switch (param3) {
case 0: { // x