Move zoning up world spheres

This commit is contained in:
2023-02-23 18:19:48 +00:00
parent f873b679aa
commit f98f95d92f
17 changed files with 96 additions and 72 deletions
+14 -10
View File
@@ -1,21 +1,25 @@
module Dodge.Wall.Zone where
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 wl = cWorld . lWorld . wlZoning %~ zoneWall wl
--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
insertWallInZones = over wlZoning . zoneWall
deleteWallFromZones :: Wall -> World -> World
deleteWallFromZones wl = cWorld . lWorld . wlZoning %~ deZoneWall wl
deleteWallFromZones = over wlZoning . deZoneWall
-- %~ flip (foldl' (flip $ \(a,b) updateeIMInZone a b (_wlID wl))) (zoneOfWall wl)