24 lines
861 B
Haskell
24 lines
861 B
Haskell
module Dodge.Wall.Zone
|
|
where
|
|
import Dodge.Data
|
|
import Dodge.Zone
|
|
|
|
import qualified Data.IntMap.Strict as IM
|
|
import Control.Lens
|
|
--import Data.Foldable
|
|
--import Streaming
|
|
--import qualified Streaming.Prelude as S
|
|
|
|
-- need to verify that this not only inserts but also overwrites (updates) any
|
|
-- already existing walls
|
|
insertWallInZones :: Wall -> World -> World
|
|
insertWallInZones wl = wlZoning %~ updateZoning (IM.insert (_wlID wl)) wl
|
|
--insertWallInZones wl = wlZoning .updatets
|
|
-- %~ (runIdentity . (\wlzns -> S.fold_ doinsert wlzns id (zoneOfWall wl)))
|
|
-- where
|
|
-- doinsert wlzns (V2 x y) = insertIMInZone x y (_wlID wl) wl wlzns
|
|
|
|
deleteWallFromZones :: Wall -> World -> World
|
|
deleteWallFromZones wl = wlZoning %~ updateZoning (const $ IM.delete (_wlID wl)) wl
|
|
-- %~ flip (foldl' (flip $ \(a,b) updateeIMInZone a b (_wlID wl))) (zoneOfWall wl)
|