diff options
author | Nicola Mettifogo | 2007-03-22 19:49:15 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-22 19:49:15 +0000 |
commit | 3daa442c82f0820493dc4e7bb078f44d9f5f0571 (patch) | |
tree | 91b262a59f7b5bb7bfd696916f8245ea6b2beeb2 /engines/parallaction/walk.cpp | |
parent | 86a60b633d1b4835a9152427fb7e3fe3e4034672 (diff) | |
download | scummvm-rg350-3daa442c82f0820493dc4e7bb078f44d9f5f0571.tar.gz scummvm-rg350-3daa442c82f0820493dc4e7bb078f44d9f5f0571.tar.bz2 scummvm-rg350-3daa442c82f0820493dc4e7bb078f44d9f5f0571.zip |
unrolled loop in buildWalkPath and renamed some variables
svn-id: r26276
Diffstat (limited to 'engines/parallaction/walk.cpp')
-rw-r--r-- | engines/parallaction/walk.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index 8cf56fb765..05607a505b 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -178,35 +178,27 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { // path is obstructed: find alternative - WalkNode v58; - addNode(&v58, v48); + WalkNode dummy; + addNode(&dummy, v48); Common::Point stop(v48->_x, v48->_y); Common::Point pos(_vm->_char._ani._left, _vm->_char._ani._top); - bool emptyList = true; - - do { - - v48 = &v58; - - uint32 v34 = buildSubPath(pos, stop, v48); - - if (!emptyList) break; - - if (v38 != 0 && v34 > v38) { - // no alternative path (gap?) - freeNodeList(v58._next); - return v44; - } + v48 = &dummy; + uint32 v34 = buildSubPath(pos, stop, v48); + if (v38 != 0 && v34 > v38) { + // no alternative path (gap?) + freeNodeList(dummy._next); + return v44; + } - ((WalkNode*)(v58._next))->getPoint(stop); - emptyList = false; + ((WalkNode*)(dummy._next))->getPoint(stop); - } while (true); + v48 = &dummy; + buildSubPath(pos, stop, v48); delete v44; - return (WalkNode*)v58._next; + return (WalkNode*)dummy._next; } |