Make pathedge zoning use sets, probably doesn't help
This commit is contained in:
@@ -4,6 +4,8 @@ module Dodge.Placement.PlaceSpot.Block (
|
||||
plLineBlock,
|
||||
) where
|
||||
|
||||
import Data.Set (Set)
|
||||
import qualified Data.Set as Set
|
||||
import Control.Lens
|
||||
import qualified Data.IntSet as IS
|
||||
import Data.List
|
||||
@@ -85,7 +87,7 @@ plLineBlock basePane blwidth a b gw =
|
||||
, _blShadows = shadowsAt i
|
||||
, _blDir = 0 -- THIS IS NOT SENSIBLE. TODO rethink block positioning
|
||||
, _blFootprint = cornersAt p -- TODO check winding (clockwise, anticlockwise)
|
||||
, _blObstructs = []
|
||||
, _blObstructs = mempty
|
||||
, _blMaterial = _wlMaterial basePane
|
||||
, _blHeight = 100
|
||||
, _blPos = p
|
||||
@@ -113,11 +115,11 @@ plLineBlock basePane blwidth a b gw =
|
||||
|
||||
-- | Must be done after inserting the block
|
||||
insertWalls :: Int -> [Wall] -> World -> World
|
||||
insertWalls blid wls w = w' & cWorld . blocks . ix blid . blObstructs .~ concat paths
|
||||
insertWalls blid wls w = w' & cWorld . blocks . ix blid . blObstructs .~ Set.unions paths
|
||||
where
|
||||
(w', paths) = mapAccumR (flip insertWall) w wls
|
||||
|
||||
insertWall :: Wall -> World -> (World, [(Int, Int, PathEdge)])
|
||||
insertWall :: Wall -> World -> (World, Set (Int, Int, PathEdge))
|
||||
insertWall wl =
|
||||
uncurry (obstructPathsCrossing BlockObstacle) (_wlLine wl)
|
||||
. (cWorld . walls . at (_wlID wl) ?~ wl)
|
||||
|
||||
@@ -4,6 +4,7 @@ module Dodge.Placement.PlaceSpot.TriggerDoor (
|
||||
maybeClearDoorPaths,
|
||||
) where
|
||||
|
||||
import Data.Set (Set)
|
||||
import qualified Data.Graph.Inductive as FGL
|
||||
import qualified Data.IntSet as IS
|
||||
import Data.List
|
||||
@@ -60,11 +61,11 @@ addDoorWall eo drid wl w (wlid, wlps) =
|
||||
, _wlID = wlid
|
||||
, _wlStructure = DoorPart drid
|
||||
}
|
||||
& cWorld . doors . ix drid . drObstructs .++~ es
|
||||
& cWorld . doors . ix drid . drObstructs <>~ es
|
||||
where
|
||||
(w', es) = uncurry (obstructPathsCrossing eo) wlps w
|
||||
|
||||
maybeClearDoorPaths :: EdgeObstacle -> [(Int, Int, PathEdge)] -> World -> World
|
||||
maybeClearDoorPaths :: EdgeObstacle -> Set (Int, Int, PathEdge) -> World -> World
|
||||
maybeClearDoorPaths eo es w = foldl' (maybeClearDoorPath eo) w es
|
||||
|
||||
maybeClearDoorPath :: EdgeObstacle -> World -> (Int, Int, PathEdge) -> World
|
||||
|
||||
Reference in New Issue
Block a user