Fix path updating when doors move
This commit is contained in:
@@ -37,11 +37,7 @@ defaultWall =
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultDoorWall :: Wall
|
defaultDoorWall :: Wall
|
||||||
defaultDoorWall =
|
defaultDoorWall = defaultWall { _wlMaterial = Metal }
|
||||||
defaultWall
|
|
||||||
{ _wlPathable = True
|
|
||||||
, _wlMaterial = Metal
|
|
||||||
}
|
|
||||||
|
|
||||||
{- Indestructible see-through wall. -}
|
{- Indestructible see-through wall. -}
|
||||||
defaultCrystalWall :: Wall
|
defaultCrystalWall :: Wall
|
||||||
|
|||||||
+4
-4
@@ -319,13 +319,13 @@ updateEdgesWall = flip $ foldl' updateEdgeWallObs
|
|||||||
updateEdgeWallObs :: World -> (Int,Int) -> World
|
updateEdgeWallObs :: World -> (Int,Int) -> World
|
||||||
updateEdgeWallObs w (i,j) = fromMaybe w $ do
|
updateEdgeWallObs w (i,j) = fromMaybe w $ do
|
||||||
s <- getNodePos i w
|
s <- getNodePos i w
|
||||||
e <- getNodePos i w
|
e <- getNodePos j w
|
||||||
let wls = snd <$> wlsHitUnsorted s e w
|
let wls = snd <$> wlsHitUnsorted s e w
|
||||||
return $ w & cWorld . incGraph %~ updateEdge (f wls) (i,j)
|
return $ w & cWorld . incGraph %~ updateEdge (f wls) (i,j)
|
||||||
where
|
where
|
||||||
f wls = at DoorObstacle ?~ ()
|
f wls
|
||||||
-- | all _wlWalkable wls = (at BlockObstacle .~ Nothing) . (at DoorObstacle .~ Nothing)
|
| all _wlPathable wls = (at BlockObstacle .~ Nothing) . (at DoorObstacle .~ Nothing)
|
||||||
-- | otherwise = at DoorObstacle ?~ ()
|
| otherwise = at DoorObstacle ?~ ()
|
||||||
|
|
||||||
updateDoors :: World -> World
|
updateDoors :: World -> World
|
||||||
updateDoors w = let (is,w') = foldrM doDrWdWd' w (w ^. cWorld . lWorld . doors)
|
updateDoors w = let (is,w') = foldrM doDrWdWd' w (w ^. cWorld . lWorld . doors)
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ zoneOfPoint = fmap . divTo
|
|||||||
zoneOfSeg :: Float -> Point2 -> Point2 -> [Int2]
|
zoneOfSeg :: Float -> Point2 -> Point2 -> [Int2]
|
||||||
{-# INLINE zoneOfSeg #-}
|
{-# INLINE zoneOfSeg #-}
|
||||||
zoneOfSeg s sp ep = map (zoneOfPoint s) (sp : xIntercepts s sp ep ++ yIntercepts s sp ep)
|
zoneOfSeg s sp ep = map (zoneOfPoint s) (sp : xIntercepts s sp ep ++ yIntercepts s sp ep)
|
||||||
--zoneOfSeg s sp ep = map (zoneOfPoint s) (sp : xIntercepts s sp ep )
|
|
||||||
|
|
||||||
zoneOfSegSet :: Float -> Point2 -> Point2 -> S.Set Int2
|
zoneOfSegSet :: Float -> Point2 -> Point2 -> S.Set Int2
|
||||||
{-# INLINE zoneOfSegSet #-}
|
{-# INLINE zoneOfSegSet #-}
|
||||||
|
|||||||
Reference in New Issue
Block a user