25 lines
645 B
Haskell
25 lines
645 B
Haskell
module Dodge.Wall.Zone
|
|
( initWallZoning
|
|
, insertWallInZones
|
|
, deleteWallFromZones
|
|
) where
|
|
|
|
import Data.Foldable
|
|
import Control.Lens
|
|
import Dodge.Data.World
|
|
import Dodge.Zoning.Wall
|
|
|
|
initWallZoning :: World -> World
|
|
initWallZoning w = foldl'
|
|
(flip insertWallInZones)
|
|
(w & wlZoning .~ mempty)
|
|
(w ^. cWorld . lWorld . walls)
|
|
|
|
-- need to verify that this not only inserts but also overwrites (updates) any
|
|
-- already existing walls
|
|
insertWallInZones :: Wall -> World -> World
|
|
insertWallInZones = over wlZoning . zoneWall
|
|
|
|
deleteWallFromZones :: Wall -> World -> World
|
|
deleteWallFromZones = over wlZoning . deZoneWall
|