diff options
author | Strangerke | 2014-02-28 22:20:38 +0100 |
---|---|---|
committer | Strangerke | 2014-02-28 22:20:38 +0100 |
commit | d35f470bf6290eb9ab5a86321b223ae3f1cb48fa (patch) | |
tree | d0dd9f7e628c92f5d25d8bb914b1a2a9209a2967 | |
parent | a140837f79362d50ef772b301a2a9413c31f9d6b (diff) | |
download | scummvm-rg350-d35f470bf6290eb9ab5a86321b223ae3f1cb48fa.tar.gz scummvm-rg350-d35f470bf6290eb9ab5a86321b223ae3f1cb48fa.tar.bz2 scummvm-rg350-d35f470bf6290eb9ab5a86321b223ae3f1cb48fa.zip |
TONY: Reduce the scope of some variables, change the return type of findPath()
-rw-r--r-- | engines/tony/loc.cpp | 13 | ||||
-rw-r--r-- | engines/tony/loc.h | 2 | ||||
-rw-r--r-- | engines/tony/mpal/mpal.cpp | 3 |
3 files changed, 8 insertions, 10 deletions
diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp index dac6390372..09a00deed1 100644 --- a/engines/tony/loc.cpp +++ b/engines/tony/loc.cpp @@ -892,12 +892,12 @@ void RMWipe::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { /* Returns path along the vector path path[] */ /****************************************************************************/ -short RMCharacter::findPath(short source, short destination) { +bool RMCharacter::findPath(short source, short destination) { static RMBox box[MAXBOXES]; // Matrix of adjacent boxes static short nodeCost[MAXBOXES]; // Cost per node static short valid[MAXBOXES]; // 0:Invalid 1:Valid 2:Saturated static short nextNode[MAXBOXES]; // Next node - short minCost, error = 0; + bool error = false; RMBoxLoc *cur; g_system->lockMutex(_csMove); @@ -925,13 +925,13 @@ short RMCharacter::findPath(short source, short destination) { // Find the shortest path while (!finish) { - minCost = 32000; // Reset the minimum cost - error = 1; // Possible error + short minCost = 32000; // Reset the minimum cost + error = true; // Possible error // 1st cycle: explore possible new nodes for (int i = 0; i < cur->_numbBox; i++) { if (valid[i] == 1) { - error = 0; // Failure de-bunked + error = false; // Failure de-bunked int j = 0; while (((box[i]._adj[j]) != 1) && (j < cur->_numbBox)) j++; @@ -1851,10 +1851,9 @@ void RMGameBoxes::loadState(byte *state) { assert(nloc <= _nLocBoxes); - int nbox; // For each location, read the number of boxes and their status for (int i = 1; i <= nloc; i++) { - nbox = READ_LE_UINT32(state); + int nbox = READ_LE_UINT32(state); state += 4; for (int j = 0; j < nbox ; j++) { diff --git a/engines/tony/loc.h b/engines/tony/loc.h index c570913d3c..ac65a4a0bd 100644 --- a/engines/tony/loc.h +++ b/engines/tony/loc.h @@ -395,7 +395,7 @@ private: private: int inWhichBox(const RMPoint &pt); - short findPath(short source, short destination); + bool findPath(short source, short destination); RMPoint searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint point); RMPoint nearestPoint(const RMPoint &punto); diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 797c7dbae0..3084fd89af 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -1524,7 +1524,6 @@ void mpalFree() { uint32 mpalQueryDWORD(uint16 wQueryType, ...) { Common::String buf; uint32 dwRet = 0; - char *n; va_list v; va_start(v, wQueryType); @@ -1625,7 +1624,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { */ 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'; |