Move zoning up world spheres
This commit is contained in:
+14
-10
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user