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

Strangerke Strangerke at scummvm.org
Fri Feb 28 22:22:18 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:
d35f470bf6 TONY: Reduce the scope of some variables, change the return type of findPath()


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

Commit Message:
TONY: Reduce the scope of some variables, change the return type of findPath()

Changed paths:
    engines/tony/loc.cpp
    engines/tony/loc.h
    engines/tony/mpal/mpal.cpp



diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp
index dac6390..09a00de 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 c570913..ac65a4a 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 797c7db..3084fd8 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';






More information about the Scummvm-git-logs mailing list