diff --git a/src/Interior.hs b/src/Interior.hs index aa53bd5..545956a 100644 --- a/src/Interior.hs +++ b/src/Interior.hs @@ -125,11 +125,18 @@ placeInteriorIO imat imgmat irp graph = then A.log A.Debug ("no cluster placed") $ placeCluster g2 bnds (try + 1) mat rp appl else if - not (isReachable newmat [] (oldreaches ++ reaches) exits) + any (`elem` (oldreaches)) + (V2 + <$> [pr .. pr + nrows cmat - 1] + <*> [pc .. pc + ncols cmat - 1]) then A.log A.Debug ("no cluster placed") $ placeCluster g2 bnds (try + 1) mat rp appl - else A.log A.Debug ("placed cluster" ++ show appl) $ - placeCluster g2 bnds (try + 1) newmat newrp appl + else if + not (isReachable newmat [] (oldreaches ++ reaches) exits) + then A.log A.Debug ("no cluster placed") $ + placeCluster g2 bnds (try + 1) mat rp appl + else A.log A.Debug ("placed cluster" ++ show appl) $ + placeCluster g2 bnds (try + 1) newmat newrp appl insertMat :: Matrix (Maybe a) diff --git a/src/Navigation.hs b/src/Navigation.hs index c43aeba..f6aaec5 100644 --- a/src/Navigation.hs +++ b/src/Navigation.hs @@ -3,7 +3,7 @@ module Navigation where import Affection as A import Data.Matrix as M -import Data.Maybe (isJust) +import Data.Maybe (isJust, catMaybes) -- internal imports diff --git a/src/Types/Collidible.hs b/src/Types/Collidible.hs index c60b2c1..d22e35f 100644 --- a/src/Types/Collidible.hs +++ b/src/Types/Collidible.hs @@ -97,5 +97,5 @@ instance Collidible ImgId where [ Boundaries (14/36, 14/36) (22/36, 22/36) ] collisionObstacle ImgEmptyNoWalk = - [ Boundaries (0, 0) (1, 1) ] + [ Boundaries (0, 0) (0.99, 0.99) ] collisionObstacle _ = [] diff --git a/src/Util.hs b/src/Util.hs index 7e6585c..fce4a77 100644 --- a/src/Util.hs +++ b/src/Util.hs @@ -193,7 +193,7 @@ naviGraph imgmat animBounds (V2 r c) = (\(V2 br bc, _) -> floor br == r + oor && floor bc == c + ooc) animBounds)) [(0, cc), (rr, 0)]) - then V2 (r + rr) (c + cc): acc + then V2 (r + rr) (c + cc) : acc else acc ) []