From 749cd3b1159d132a2dc58afdf1817b1cee41f634 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Aug 2011 00:03:44 +0200 Subject: CGE: Another fix for the pathfinding --- engines/cge/walk.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'engines/cge/walk.cpp') diff --git a/engines/cge/walk.cpp b/engines/cge/walk.cpp index 914f6db669..ccbb0e5532 100644 --- a/engines/cge/walk.cpp +++ b/engines/cge/walk.cpp @@ -47,12 +47,6 @@ bool Cluster::isValid() const { return (_a >= 0) && (_a < kMapXCnt) && (_b >= 0) && (_b < kMapZCnt); } -bool Cluster::chkBar() const { - assert(_vm->_now <= _vm->_caveMax); - return (_a < 0) || (_b < 0) || (_a >= _vm->_barriers[_vm->_now]._horz) || - (_b >= _vm->_barriers[_vm->_now]._vert); -} - Cluster XZ(int x, int y) { if (y < kMapTop) y = kMapTop; @@ -230,6 +224,11 @@ void Walk::noWay() { _vm->trouble(kSeqNoWay, kNoWay); } +bool Cluster::chkBar() const { + assert(_vm->_now <= _vm->_caveMax); + return (_a == _vm->_barriers[_vm->_now]._horz) || (_b == _vm->_barriers[_vm->_now]._vert); +} + bool Walk::find1Way(Cluster c) { Cluster start = c; const Cluster tab[4] = { Cluster(-1, 0), Cluster(1, 0), Cluster(0, -1), Cluster(0, 1)}; @@ -251,7 +250,6 @@ bool Walk::find1Way(Cluster c) { // Location is occupied return false; - // Loop through each direction for (int i = 0; i < tabLen; i++) { // Reset to starting position -- cgit v1.2.3