[Scummvm-cvs-logs] SF.net SVN: scummvm: [20787] scummvm/trunk/engines/sword2

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Feb 20 06:19:12 CET 2006


Revision: 20787
Author:   fingolfin
Date:     2006-02-20 06:18:30 -0800 (Mon, 20 Feb 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=20787&view=rev

Log Message:
-----------
Fix for bug #1428261 (Solaris x86 build fails: variable name collision)

Modified Paths:
--------------
    scummvm/trunk/engines/sword1/router.cpp
    scummvm/trunk/engines/sword2/router.cpp
Modified: scummvm/trunk/engines/sword1/router.cpp
===================================================================
--- scummvm/trunk/engines/sword1/router.cpp	2006-02-20 14:12:59 UTC (rev 20786)
+++ scummvm/trunk/engines/sword1/router.cpp	2006-02-20 14:18:30 UTC (rev 20787)
@@ -290,13 +290,7 @@
 	int32	dSD;
 	int32	dDS;
 	int32	dDD;
-	int32	SS;
-	int32	SD;
-	int32	DS;
-	int32	DD;
 	int32	i;
-	int32	j;
-	int32	temp;
 	int32	steps;
 	int32	option;
 	int32	options;
@@ -305,7 +299,7 @@
 	int32 nextDirD;
 	int32 tempturns[4];
 	int32 turns[4];
-	int32 turntable[NO_DIRECTIONS] = {0,1,3,5,7,5,3,1};
+	int32 turntable[NO_DIRECTIONS] = { 0, 1, 3, 5, 7, 5, 3, 1 };
 
 //	targetDir;// no warnings
 
@@ -360,48 +354,30 @@
 		dDS = turntable[dDS];
 		// get the best path out ie assume next section uses best direction
 		if (dSD < dSS)
-		{
 			dSS = dSD;
-		}
 		if (dDS < dDD)
-		{
 			dDD = dDS;
-		}
-		// rate each option
-		SS = dS + dSS + 3;		// Split routes look crap so weight against them
-		SD = dS + dDD;
-		DS = dD + dSS;
-		DD = dD + dDD + 3;
-		// set up turns as a sorted	array of the turn values
-		tempturns[0] = SS;
+
+		// Rate each option. Split routes look crap so weight against
+		// them
+		tempturns[0] = dS + dSS + 3;
 		turns[0] = 0;
-		tempturns[1] = SD;
+		tempturns[1] = dS + dDD;
 		turns[1] = 1;
-		tempturns[2] = DS;
+		tempturns[2] = dD + dSS;
 		turns[2] = 2;
-		tempturns[3] = DD;
+		tempturns[3] = dD + dDD + 3;
 		turns[3] = 3;
-		i = 0;
-		do
-		{
-			j = 0;
-			do
-			{
-				if (tempturns[j] > tempturns[j + 1])
-				{
-					temp = turns[j];
-					turns[j] = turns[j+1];
-					turns[j+1] = temp;
-					temp = tempturns[j];
-					tempturns[j] = tempturns[j+1];
-					tempturns[j+1] = temp;
+
+		// set up turns as a sorted	array of the turn values
+		for (i = 0; i < 3; i++) {
+			for (int j = 0; j < 3; j++) {
+				if (tempturns[j] > tempturns[j + 1]) {
+					SWAP(turns[j], turns[j + 1]);
+					SWAP(tempturns[j], tempturns[j + 1]);
 				}
-				j = j + 1;
 			}
-			while (j < 3);
-			i = i + 1;
 		}
-		while (i < 3);
 
 		// best option matched in order of the priority we would like to see on the screen
 		// but each option must be checked to see if it can be walked

Modified: scummvm/trunk/engines/sword2/router.cpp
===================================================================
--- scummvm/trunk/engines/sword2/router.cpp	2006-02-20 14:12:59 UTC (rev 20786)
+++ scummvm/trunk/engines/sword2/router.cpp	2006-02-20 14:18:30 UTC (rev 20787)
@@ -435,23 +435,17 @@
 
 		// Rate each option. Split routes look crap so weight against
 		// them
-
-		int32 SS = dS + dSS + 3;
-		int32 SD = dS + dDD;
-		int32 DS = dD + dSS;
-		int32 DD = dD + dDD + 3;
-
-		// set up turns as a sorted array of the turn values
-
-		tempturns[0] = SS;
+		tempturns[0] = dS + dSS + 3;
 		turns[0] = 0;
-		tempturns[1] = SD;
+		tempturns[1] = dS + dDD;
 		turns[1] = 1;
-		tempturns[2] = DS;
+		tempturns[2] = dD + dSS;
 		turns[2] = 2;
-		tempturns[3] = DD;
+		tempturns[3] = dD + dDD + 3;
 		turns[3] = 3;
 
+		// set up turns as a sorted array of the turn values
+
 		for (i = 0; i < 3; i++) {
 			for (int j = 0; j < 3; j++) {
 				if (tempturns[j] > tempturns[j + 1]) {







More information about the Scummvm-git-logs mailing list