From f358ec74f7ac4575e5450fd468a46aba2190da91 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Feb 2014 22:47:36 +0100 Subject: TONY: Reduce the scope of some more variables --- engines/tony/inventory.cpp | 7 +++---- engines/tony/mpal/loadmpc.cpp | 4 +--- engines/tony/mpal/mpal.cpp | 6 +----- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp index 1ffc0a4cf4..974be8b04d 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 8f63b07ca0..8d030f1e52 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 3084fd89af..305f89765b 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'; -- cgit v1.2.3