clearance levels now implemented
This commit is contained in:
parent
763d945384
commit
44d0da34ac
2 changed files with 28 additions and 14 deletions
|
@ -437,6 +437,19 @@ assignClearance graph imat =
|
|||
then do
|
||||
if actualRoomType b imat == Offi
|
||||
then do
|
||||
let neigh = filter (all ((/= Hall) . snd) . neighbs) $
|
||||
catMaybes
|
||||
(map
|
||||
(\n -> findNeighbor n b imat onlyrooms)
|
||||
nonhalls
|
||||
)
|
||||
onlyrooms = tail graph
|
||||
nonhalls = ns -- filter ((/= Hall) . snd) ns
|
||||
A.logIO A.Debug ("neighs: " ++ show neigh)
|
||||
if not (null neigh) && any ((Offi /=) . flip actualRoomType imat . bounds) neigh
|
||||
then
|
||||
return room
|
||||
else do
|
||||
ret <- doRandomAssign room
|
||||
return ret
|
||||
else return room
|
||||
|
@ -449,13 +462,14 @@ assignClearance graph imat =
|
|||
(\n -> findNeighbor n b imat onlyrooms)
|
||||
nonhalls
|
||||
)
|
||||
onlyrooms = connects (head acc) ++ tail acc
|
||||
onlyrooms = connects (head acc)
|
||||
nonhalls = ns -- filter ((/= Hall) . snd) ns
|
||||
ret <- if null neigh
|
||||
then doRandomAssign room
|
||||
else doBoundedAssign room (clearance $ head neigh)
|
||||
return ret
|
||||
else return room
|
||||
else
|
||||
return room
|
||||
|
||||
actualRoomType :: Boundaries Int -> M.Matrix TileState -> TileState
|
||||
actualRoomType (Boundaries (minrow, mincol) (maxrow, maxcol)) imat =
|
||||
|
@ -502,7 +516,7 @@ findNeighbor (dir, _) bnds imat ingraph
|
|||
(inBounds (V2 row col) . bounds)
|
||||
ingraph
|
||||
in
|
||||
case A.log A.Debug ("filtered: " ++ show filtered) filtered of
|
||||
case filtered of
|
||||
[a@(GRoom _ _ _ ts)] -> Just a
|
||||
-- if ts == neighTile row col
|
||||
-- then Just a
|
||||
|
|
Loading…
Reference in a new issue