Introduce safeMinimumOn

This commit is contained in:
2021-07-20 04:34:28 +02:00
parent 6905c6f154
commit 58b2c8a842
5 changed files with 59 additions and 28 deletions
+5 -2
View File
@@ -28,8 +28,8 @@ import Data.Graph.Inductive.Graph (labNodes)
import qualified Data.Map as M
generateLevelFromRoomList :: State StdGen [Room] -> World -> World
generateLevelFromRoomList gr w = initializeStaticWalls
. updateWallZoning
generateLevelFromRoomList gr w = updateWallZoning
-- . initializeStaticWalls
. placeSpots plmnts
-- . addRoomPolyDecorations rs
-- . addRoomLinkDecorations rs
@@ -61,8 +61,11 @@ generateFromTree t w = updateWallZoning $ placeSpots plmnts
initializeStaticWalls :: World -> World
initializeStaticWalls w = w & staticWalls %~ (\wls' -> foldr wallToWall wls' wls)
& walls %~ IM.filter (not . wlIsWall)
where
wls = [wl | wl@Wall{} <- (IM.elems $ _walls w)]
wlIsWall Wall{} = True
wlIsWall _ = False
wallToWall :: Wall -> IM.IntMap (IM.IntMap [Wall']) -> IM.IntMap (IM.IntMap [Wall'])
wallToWall wl wls = foldr f wls is