unrolled loop in buildWalkPath and renamed some variables

svn-id: r26276
This commit is contained in:
Nicola Mettifogo 2007-03-22 19:49:15 +00:00
parent 86a60b633d
commit 3daa442c82

View File

@ -178,35 +178,27 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) {
// path is obstructed: find alternative // path is obstructed: find alternative
WalkNode v58; WalkNode dummy;
addNode(&v58, v48); addNode(&dummy, v48);
Common::Point stop(v48->_x, v48->_y); Common::Point stop(v48->_x, v48->_y);
Common::Point pos(_vm->_char._ani._left, _vm->_char._ani._top); Common::Point pos(_vm->_char._ani._left, _vm->_char._ani._top);
bool emptyList = true; v48 = &dummy;
do {
v48 = &v58;
uint32 v34 = buildSubPath(pos, stop, v48); uint32 v34 = buildSubPath(pos, stop, v48);
if (!emptyList) break;
if (v38 != 0 && v34 > v38) { if (v38 != 0 && v34 > v38) {
// no alternative path (gap?) // no alternative path (gap?)
freeNodeList(v58._next); freeNodeList(dummy._next);
return v44; return v44;
} }
((WalkNode*)(v58._next))->getPoint(stop); ((WalkNode*)(dummy._next))->getPoint(stop);
emptyList = false;
} while (true); v48 = &dummy;
buildSubPath(pos, stop, v48);
delete v44; delete v44;
return (WalkNode*)v58._next; return (WalkNode*)dummy._next;
} }