Continue to refactor zoning to be more stream-based

This commit is contained in:
2022-06-28 03:21:55 +01:00
parent f6d96ec92c
commit e06527091e
34 changed files with 214 additions and 252 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ makePathBetween a b w = do -- join $ sp <$> a' <*> b' <*> return (_pathGraph w)
nb <- walkableNodeNear b
sp na nb (_pathGraph w)
where
nodesNear p = concat $ lookLookups (zoneAroundPoint p) (_pathPoints w)
nodesNear p = concat $ lookLookups (zoneNearPointIP p) (_pathPoints w)
walkableNodeNear p = fmap fst . find (flip (isWalkable p) w . snd) $ nodesNear p
makePathBetweenPs :: Point2 -> Point2 -> World -> Maybe [Point2]
@@ -92,5 +92,5 @@ removePathsCrossing a b w = w
& pathPoints .~ foldr insertPoint IM.empty (labNodes newGraph)
where
pg' = S.filter (isNothing . uncurry (intersectSegSeg a b)) $ _pathGraphP w
insertPoint pp@(_,V2 x y) = insertInZoneWith (floorHun x) (floorHun y) (++) [pp]
insertPoint pp@(_,p) = uncurryV insertInZoneWith (wallZoneOfPoint p) (++) [pp]
newGraph = pairsToGraph dist pg'