[Scummvm-cvs-logs] SF.net SVN: scummvm:[45279] scummvm/trunk/engines/sword1
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Oct 20 21:11:22 CEST 2009
Revision: 45279
http://scummvm.svn.sourceforge.net/scummvm/?rev=45279&view=rev
Author: fingolfin
Date: 2009-10-20 19:11:22 +0000 (Tue, 20 Oct 2009)
Log Message:
-----------
SWORD1: Resolve FIXME about weird static var 'k' in Router::smoothCheck
Modified Paths:
--------------
scummvm/trunk/engines/sword1/router.cpp
scummvm/trunk/engines/sword1/router.h
Modified: scummvm/trunk/engines/sword1/router.cpp
===================================================================
--- scummvm/trunk/engines/sword1/router.cpp 2009-10-20 19:10:51 UTC (rev 45278)
+++ scummvm/trunk/engines/sword1/router.cpp 2009-10-20 19:11:22 UTC (rev 45279)
@@ -327,7 +327,6 @@
lastDir = _startDir;
// for each section of the route
-
for (int p = 0; p < _routeLength; p++) {
int32 dirS = _route[p].dirS;
int32 dirD = _route[p].dirD;
@@ -402,17 +401,15 @@
assert(options);
- i = 0;
- steps = 0;
-
- do {
+ for (i = 0; i < 4; ++i) {
int32 opt = 1 << turns[i];
- if (options & opt)
- steps = smoothCheck(turns[i], p, dirS, dirD);
- i++;
- } while (steps == 0 && i < 4);
+ if (options & opt) {
+ smoothCheck(steps, turns[i], p, dirS, dirD);
+ break;
+ }
+ }
- assert(steps);
+ assert(i < 4);
// route.X route.Y route.dir and bestTurns start at far end
}
@@ -425,7 +422,7 @@
return 1;
}
-int32 Router::smoothCheck(int32 best, int32 p, int32 dirS, int32 dirD) {
+void Router::smoothCheck(int32 &k, int32 best, int32 p, int32 dirS, int32 dirD) {
/*********************************************************************
* Slip sliding away
* This path checker checks to see if a walk that exactly follows the
@@ -434,9 +431,6 @@
* No longer checks the data it only creates the smoothPath array JPS
*********************************************************************/
- // FIXME: Using 'static' vars in a method is evil -- they should almost
- // always be turned into member variables instead.
- static int32 k;
int32 dsx, dsy;
int32 ddx, ddy;
int32 ss0, ss1, ss2;
@@ -568,8 +562,6 @@
break;
}
-
- return k;
}
void Router::slidyPath() {
Modified: scummvm/trunk/engines/sword1/router.h
===================================================================
--- scummvm/trunk/engines/sword1/router.h 2009-10-20 19:10:51 UTC (rev 45278)
+++ scummvm/trunk/engines/sword1/router.h 2009-10-20 19:11:22 UTC (rev 45279)
@@ -118,14 +118,10 @@
int32 megaId;
- /*RouteData _route[O_ROUTE_SIZE];
- //int32 _routeLength;
- PathData _smoothPath[O_ROUTE_SIZE];
- PathData _modularPath[O_ROUTE_SIZE];*/
- RouteData _route[O_ROUTE_SIZE];
- PathData _smoothPath[O_ROUTE_SIZE];
- PathData _modularPath[O_ROUTE_SIZE];
- int32 _routeLength;
+ RouteData _route[O_ROUTE_SIZE];
+ PathData _smoothPath[O_ROUTE_SIZE];
+ PathData _modularPath[O_ROUTE_SIZE];
+ int32 _routeLength;
int32 _framesPerStep, _framesPerChar;
uint8 _nWalkFrames, _nTurnFrames;
@@ -157,7 +153,7 @@
void slidyWalkAnimator(WalkData *walkAnim);
int32 smoothestPath();
- int32 smoothCheck(int32 best, int32 p, int32 dirS, int32 dirD);
+ void smoothCheck(int32 &steps, int32 best, int32 p, int32 dirS, int32 dirD);
void solidPath();
int32 solidWalkAnimator(WalkData *walkAnim);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list