[Scummvm-cvs-logs] CVS: scummvm/sword1 logic.cpp,1.4,1.5 router.cpp,1.3,1.4 router.h,1.2,1.3

Max Horn fingolfin at users.sourceforge.net
Tue Dec 16 17:19:07 CET 2003


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv20700

Modified Files:
	logic.cpp router.cpp router.h 
Log Message:
fix various warnings; whatTarget()'s paramters shadowed member vars, but it can just b e turned into a pure function (sidenote: the chaotic mix of spaces and tabs in router.cpp doesn't help readability :-)

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/logic.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- logic.cpp	16 Dec 2003 19:55:59 -0000	1.4
+++ logic.cpp	17 Dec 2003 01:18:03 -0000	1.5
@@ -1414,13 +1414,13 @@
 		x = (target->o_mouse_x1 + target->o_mouse_x2) / 2;
 		y = (target->o_mouse_y1 + target->o_mouse_y2) / 2;
 	}
-	int32 megaTarDir = _router->whatTarget(cpt->o_xcoord, cpt->o_ycoord, x, y);
+	int32 megaTarDir = whatTarget(cpt->o_xcoord, cpt->o_ycoord, x, y);
 	fnTurn(cpt, id, megaTarDir, 0, 0, 0, 0, 0);
 	return SCRIPT_STOP;
 }
 
 int SwordLogic::fnFaceXy(BsObject *cpt, int32 id, int32 x, int32 y, int32 c, int32 d, int32 a, int32 b) {
-	int megaTarDir = _router->whatTarget(cpt->o_xcoord, cpt->o_ycoord, x, y);
+	int megaTarDir = whatTarget(cpt->o_xcoord, cpt->o_ycoord, x, y);
 	fnTurn(cpt, id, megaTarDir, 0, 0, 0, 0, 0);
 	return SCRIPT_STOP;
 }
@@ -1435,7 +1435,7 @@
 	} else
 		error("fnIsFacing:: Target isn't a mega!");
 
-	int32 lookDir = _router->whatTarget(x, y, cpt->o_xcoord, cpt->o_ycoord);
+	int32 lookDir = whatTarget(x, y, cpt->o_xcoord, cpt->o_ycoord);
 	lookDir -= dir;
 	lookDir = abs(lookDir);
 

Index: router.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/router.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- router.cpp	16 Dec 2003 18:23:15 -0000	1.3
+++ router.cpp	17 Dec 2003 01:18:03 -0000	1.4
@@ -352,7 +352,7 @@
   int32 turns[4];     
   int32 turntable[NO_DIRECTIONS] = {0,1,3,5,7,5,3,1};
 
-	targetDir;// no warnings
+//	targetDir;// no warnings
 
 	// route.X route.Y and route.Dir start at far end
 	smoothPath[0].x = startX;
@@ -903,8 +903,8 @@
 			scale = (scaleA * moduleY + scaleB);
 			do
 			{
-				module16X += dx[module]*scale;
-				module16Y += dy[module]*scale;
+				module16X += _dx[module]*scale;
+				module16Y += _dy[module]*scale;
 				moduleX = module16X >> 16;
 				moduleY = module16Y >> 16;
 				walkAnim[stepCount].frame = module;
@@ -1425,8 +1425,8 @@
 				scale = (scaleA * moduleY + scaleB);
 				do
 				{
-					module16X += dx[module]*scale;
-					module16Y += dy[module]*scale;
+					module16X += _dx[module]*scale;
+					module16Y += _dy[module]*scale;
 					moduleX = module16X >> 16;
 					moduleY = module16Y >> 16;
 					walkAnim[stepCount].frame = module;
@@ -2340,7 +2340,7 @@
 
 	if (nbars >= O_GRID_SIZE)
 	{
-		#if DEBUG == YES												//check for id > number in file,
+		#ifdef DEBUG												//check for id > number in file,
 		error("RouteFinder Error too many bars %d", nbars);
 		#endif
 		nbars = 0;
@@ -2350,7 +2350,7 @@
 
 	if (nnodes >= O_GRID_SIZE)
 	{
-		#if DEBUG == YES												//check for id > number in file,
+		#ifdef DEBUG												//check for id > number in file,
 			error("RouteFinder Error too many nodes %d", nnodes);
 		#endif
 		nnodes = 0;
@@ -2435,9 +2435,9 @@
 	nTurnFrames = fMegaWalkData[1];
  	fMegaWalkData += 2;
 
- 	memmove(&dx[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
+ 	memmove(&_dx[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
  	fMegaWalkData += NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32);
- 	memmove(&dy[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
+ 	memmove(&_dy[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
  	fMegaWalkData += NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32);
 
  	memmove(&modX[0],fMegaWalkData,NO_DIRECTIONS*sizeof(int32));
@@ -2527,7 +2527,6 @@
 
 	// now shuffle route down in the buffer
 	routeLength = 0;
-	point;
 	do
 	{
 		route[routeLength].x = route[point].x;
@@ -2607,7 +2606,7 @@
 
 #define DIAGONALX 36
 #define DIAGONALY 8
-int SwordRouter::whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
+int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
 	int tar_dir;
 //setting up
 	int deltaX = destX-startX;

Index: router.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/router.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- router.h	16 Dec 2003 18:23:15 -0000	1.2
+++ router.h	17 Dec 2003 01:18:03 -0000	1.3
@@ -99,12 +99,13 @@
 class ResMan;
 class SwordScreen;
 
+extern int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY);
+
 class SwordRouter {
 public:
 	SwordRouter(ObjectMan *pObjMan, ResMan *pResMan);
 	~SwordRouter(void);
 	int32 routeFinder(int32 id, BsObject *mega, int32 x, int32 y, int32 dir);
-	int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY);
 	void setPlayerTarget(int32 x, int32 y, int32 dir, int32 stance);
 	void resetExtraData(void);
 
@@ -146,8 +147,8 @@
 
 	int32		framesPerStep, framesPerChar;
 	uint8		nWalkFrames, nTurnFrames;
-	int32		dx[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
-	int32		dy[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
+	int32		_dx[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
+	int32		_dy[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
 	int32		modX[NO_DIRECTIONS];
 	int32		modY[NO_DIRECTIONS];
 	int32		diagonalx, diagonaly;





More information about the Scummvm-git-logs mailing list