Commit before static wall overhaul
This commit is contained in:
+14
-1
@@ -28,7 +28,8 @@ import Data.Graph.Inductive.Graph (labNodes)
|
||||
import qualified Data.Map as M
|
||||
|
||||
generateLevelFromRoomList :: State StdGen [Room] -> World -> World
|
||||
generateLevelFromRoomList gr w = updateWallZoning
|
||||
generateLevelFromRoomList gr w = initializeStaticWalls
|
||||
. updateWallZoning
|
||||
. placeSpots plmnts
|
||||
-- . addRoomPolyDecorations rs
|
||||
-- . addRoomLinkDecorations rs
|
||||
@@ -58,6 +59,18 @@ generateFromTree t w = updateWallZoning $ placeSpots plmnts
|
||||
insertPoint pp@(_,(x,y)) = insertInZoneWith (floorHun x) (floorHun y) (++) [pp]
|
||||
pinc = M.fromList $ pairsToIncidence pairGraph
|
||||
|
||||
initializeStaticWalls :: World -> World
|
||||
initializeStaticWalls w = w & staticWalls %~ (\wls' -> foldr wallToWall wls' wls)
|
||||
where
|
||||
wls = [wl | wl@Wall{} <- (IM.elems $ _walls w)]
|
||||
|
||||
wallToWall :: Wall -> IM.IntMap (IM.IntMap [Wall']) -> IM.IntMap (IM.IntMap [Wall'])
|
||||
wallToWall wl wls = foldr f wls is
|
||||
where
|
||||
is = uncurry zoneOfLine (_wlLine wl)
|
||||
wl' = Wall' {_wlLine' = _wlLine wl, _wlColor' = _wlColor wl}
|
||||
f (x,y) = insertInZoneWith x y (++) [wl']
|
||||
|
||||
updateWallZoning :: World -> World
|
||||
updateWallZoning w = set wallsZone (IM.foldr wallInZone IM.empty (_walls w)) w
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user