Make pathedge zoning use sets, probably doesn't help

This commit is contained in:
2022-08-24 14:01:39 +01:00
parent 13b07b53ce
commit 6973663055
16 changed files with 68 additions and 53 deletions
+5 -3
View File
@@ -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)