[Scummvm-cvs-logs] scummvm master -> f358ec74f7ac4575e5450fd468a46aba2190da91

Strangerke Strangerke at scummvm.org
Fri Feb 28 22:49:13 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:
f358ec74f7 TONY: Reduce the scope of some more variables


Commit: f358ec74f7ac4575e5450fd468a46aba2190da91
    https://github.com/scummvm/scummvm/commit/f358ec74f7ac4575e5450fd468a46aba2190da91
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-28T13:47:36-08:00

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

Changed paths:
    engines/tony/inventory.cpp
    engines/tony/mpal/loadmpc.cpp
    engines/tony/mpal/mpal.cpp



diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp
index 1ffc0a4..974be8b 100644
--- a/engines/tony/inventory.cpp
+++ b/engines/tony/inventory.cpp
@@ -457,8 +457,6 @@ bool RMInventory::rightRelease(const RMPoint &mpos, RMTonyAction &curAction) {
 #define INVSPEED 20
 
 void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpos, bool bCanOpen) {
-	bool bNeedRedraw = false;
-
 	if (_state != CLOSED) {
 		// Clean up the OT list
 		g_system->lockMutex(_csModifyInterface);
@@ -466,6 +464,8 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
 
 		// DoFrame makes all the objects currently in the inventory be displayed
 		// @@@ Maybe we should do all takeable objects? Please does not help
+		bool bNeedRedraw = false;
+
 		for (int i = 0; i < _nInv; i++) {
 			if (_items[_inv[i]]._icon.doFrame(this, false) && (i >= _curPos && i <= _curPos + 7))
 				bNeedRedraw = true;
@@ -698,9 +698,8 @@ int RMInventory::loadState(byte *state) {
 		state += 4;
 	}
 
-	int x;
 	for (int i = 0; i < 256; i++) {
-		x = READ_LE_UINT32(state);
+		int x = READ_LE_UINT32(state);
 		state += 4;
 
 		if (i < _nItems) {
diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp
index 8f63b07..8d030f1 100644
--- a/engines/tony/mpal/loadmpc.cpp
+++ b/engines/tony/mpal/loadmpc.cpp
@@ -138,8 +138,6 @@ static void FreeScript(LpMpalScript lpmsScript) {
  * @returns		Pointer to the buffer after the item, or NULL on failure.
  */
 static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) {
-	byte *lpLock;
-
 	lpmdDialog->_nObj = READ_LE_UINT32(lpBuf);
 	lpBuf += 4;
 
@@ -155,7 +153,7 @@ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) {
 		lpmdDialog->_periodNums[i] = READ_LE_UINT16(lpBuf);
 		lpBuf += 2;
 		lpmdDialog->_periods[i] = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, *lpBuf + 1);
-		lpLock = (byte *)globalLock(lpmdDialog->_periods[i]);
+		byte *lpLock = (byte *)globalLock(lpmdDialog->_periods[i]);
 		Common::copy(lpBuf + 1, lpBuf + 1 + *lpBuf, lpLock);
 		globalUnlock(lpmdDialog->_periods[i]);
 		lpBuf += (*lpBuf) + 1;
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp
index 3084fd8..305f897 100644
--- a/engines/tony/mpal/mpal.cpp
+++ b/engines/tony/mpal/mpal.cpp
@@ -1718,7 +1718,6 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
  * method that returns a pointer or handle.
  */
 MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) {
-	char *n;
 	Common::String buf;
 	va_list v;
 	va_start(v, wQueryType);
@@ -1796,12 +1795,9 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) {
 		error("mpalQuery(MPQ_ITEM_IS_ACTIVE, uint32 nItem) used incorrect variant");
 
 	} else if (wQueryType == MPQ_ITEM_NAME) {
-		/*
-		 *  uint32 mpalQuery(MPQ_ITEM_NAME, uint32 nItem, char *lpszName);
-		 */
 		lockVar();
 		int x = GETARG(uint32);
-		n = GETARG(char *);
+		char *n = GETARG(char *);
 		buf = Common::String::format("Status.%u", x);
 		if (varGetValue(buf.c_str()) <= 0)
 			n[0] = '\0';






More information about the Scummvm-git-logs mailing list