directions were flipped

This commit is contained in:
nek0 2019-02-08 22:02:19 +01:00
parent 23483de264
commit 763d945384

View file

@ -384,8 +384,8 @@ buildDoorsGraph mat =
neighs = map (\(a, bx) -> (a, fromJust bx)) (filter ((/=Nothing) . snd)
[ (North, M.safeGet (fst (matmin b) - 2) (snd (matmin b)) amat)
, (South, M.safeGet (fst (matmax b) + 2) (snd (matmin b)) amat)
, (East, M.safeGet (fst (matmin b)) (snd (matmin b) - 2) amat)
, (West, M.safeGet (fst (matmin b)) (snd (matmax b) + 2) amat)
, (West, M.safeGet (fst (matmin b)) (snd (matmin b) - 2) amat)
, (East, M.safeGet (fst (matmin b)) (snd (matmax b) + 2) amat)
])
in
if Hall `elem` map snd neighs
@ -480,20 +480,20 @@ doBoundedAssign g b = do
findNeighbor :: (GraphDirection, TileState) -> Boundaries Int -> M.Matrix TileState -> [Graph] -> Maybe Graph
findNeighbor (dir, _) bnds imat ingraph
| dir == North =
let row = fst (matmin bnds) - 1
let row = fst (matmin bnds) - 2
col = snd (matmin bnds) + ((snd (matmax bnds) - snd (matmin bnds)) `div` 2)
in postprocess row col
| dir == East =
let row = fst (matmin bnds) + ((fst (matmax bnds) - fst (matmin bnds)) `div` 2)
col = snd (matmax bnds) + 1
col = snd (matmax bnds) + 2
in postprocess row col
| dir == South =
let row = fst (matmax bnds) + 1
let row = fst (matmax bnds) + 2
col = snd (matmin bnds) + ((snd (matmax bnds) - snd (matmin bnds)) `div` 2)
in postprocess row col
| dir == West =
let row = fst (matmin bnds) + ((fst (matmax bnds) - fst (matmin bnds)) `div` 2)
col = snd (matmin bnds) - 1
col = snd (matmin bnds) - 2
in postprocess row col
where
neighTile row col = imat M.! (row, col)
@ -533,12 +533,12 @@ buildDoors = foldM placeDoors
amat
(fst (matmax bs) + 1)
(snd (matmin bs), snd (matmax bs))
East ->
West ->
inCol
amat
(fst (matmin bs), fst (matmax bs))
(snd (matmin bs) - 1)
West ->
East ->
inCol
amat
(fst (matmin bs), fst (matmax bs))
@ -557,12 +557,12 @@ buildDoors = foldM placeDoors
amat
(fst (matmax bs) + 1)
(snd (matmin bs), snd (matmax bs))
East ->
West ->
inCol
amat
(fst (matmin bs), fst (matmax bs))
(snd (matmin bs) - 1)
West ->
East ->
inCol
amat
(fst (matmin bs), fst (matmax bs))