Correctly add all obstructed paths to doors

This commit is contained in:
2022-07-02 22:59:11 +01:00
parent 46bc135e69
commit 3efd89fa34
2 changed files with 21 additions and 8 deletions
+19 -6
View File
@@ -149,15 +149,28 @@ drawInspectWalls w = foldMap (drawInspectWall w)
(a,b) = _lLine w
drawInspectWall :: World -> Wall -> Picture
drawInspectWall _ wl = setLayer DebugLayer $
drawInspectWall w wl = setLayer DebugLayer $
color rose (thickLine 3 [a,b])
<> foldMap (drawZone wlZoneSize)
(runIdentity $ S.toList_ $ zoneOfWall wlZoneSize wl) -- this won't work if wlZoneSize is not consistent
-- <> foldMap (drawZone wlZoneSize)
-- (runIdentity $ S.toList_ $ zoneOfWall wlZoneSize wl) -- this won't work if wlZoneSize is not consistent
<> foldMap (drawDoorPaths w) (wl ^? wlStructure . wsDoor)
where
(a,b) = _wlLine wl
-- $ line [a,b]
-- where
-- (a,b) = _wSelect w
drawDoorPaths :: World -> Int -> Picture
drawDoorPaths w drid = fromMaybe mempty $ do
paths <- w ^? doors . ix drid . drObstructs
-- path <- listToMaybe paths
-- undefined
return $ foldMap (drawPathEdge . (^. _3)) paths
-- return $ (drawPathEdge . (^. _3)) path
drawPathEdge :: PathEdge -> Picture
drawPathEdge pe = setLayer DebugLayer $ color col $ arrow (_peStart pe) (_peEnd pe)
where
col = case _peObstacles pe of
pos | WallObstacle `Set.member` pos -> blue
| True -> red
drawWorldSelect :: World -> Picture
drawWorldSelect w = setLayer DebugLayer