Refactor more instances to use streaming
This commit is contained in:
+10
-11
@@ -53,13 +53,15 @@ import qualified Streaming.Prelude as S
|
||||
|
||||
hasLOS :: Point2 -> Point2 -> World -> Bool
|
||||
{-# INLINE hasLOS #-}
|
||||
hasLOS p1 p2 = not . pointHitsWalls p1 p2 . wallsAlongLine p1 p2
|
||||
hasLOS p1 p2 = not
|
||||
. collidePointTestFilter (const True) p1 p2
|
||||
. wallsAlongLineStream p1 p2
|
||||
|
||||
hasButtonLOS :: Point2 -> Point2 -> World -> Bool
|
||||
{-# INLINE hasButtonLOS #-}
|
||||
hasButtonLOS p1 p2 = not . pointHitsWalls p1 p2
|
||||
. IM.filter (not . _wlTouchThrough)
|
||||
. wallsAlongLine p1 p2
|
||||
hasButtonLOS p1 p2 = not
|
||||
. collidePointTestFilter (not . _wlTouchThrough) p1 p2
|
||||
. wallsAlongLineStream p1 p2
|
||||
|
||||
--hitPointLines
|
||||
-- :: Point2
|
||||
@@ -225,9 +227,9 @@ collidePointIndirect' p1 p2
|
||||
-- the reason for using the dashed version is the hope that this will short
|
||||
-- circuit
|
||||
hasLOSIndirect :: Point2 -> Point2 -> World -> Bool
|
||||
hasLOSIndirect p1 p2 w = case collidePointIndirect' p1 p2 $ wallsAlongLine p1 p2 w of
|
||||
Just _ -> False
|
||||
Nothing -> True
|
||||
hasLOSIndirect p1 p2 = not
|
||||
. collidePointTestFilter wlIsOpaque p1 p2
|
||||
. wallsAlongLineStream p1 p2
|
||||
|
||||
isWalkable :: Point2 -> Point2 -> World -> Bool
|
||||
isWalkable p1 p2 = not
|
||||
@@ -283,10 +285,7 @@ canSee i j w = hasLOS p1 p2 w
|
||||
-- jpos = _crPos (_creatures w IM.! j)
|
||||
|
||||
canSeeIndirect :: Int -> Int -> World -> Bool
|
||||
canSeeIndirect i j w = not
|
||||
$ any (isJust . uncurry (intersectSegSeg ipos jpos) . _wlLine)
|
||||
$ IM.filter wlIsOpaque
|
||||
$ wallsAlongLine ipos jpos w
|
||||
canSeeIndirect i j w = hasLOSIndirect ipos jpos w
|
||||
where
|
||||
ipos = _crPos (_creatures w IM.! i)
|
||||
jpos = _crPos (_creatures w IM.! j)
|
||||
|
||||
+7
-6
@@ -44,12 +44,13 @@ initialAnoTree = OnwardList
|
||||
, AnRoom slowDoorRoom
|
||||
, AnTree firstBreather
|
||||
, AnTree $ telRoomLev 1 >>= rToOnward "telRoomLev" . pure . cleatOnward
|
||||
]
|
||||
|
||||
extraAnoList :: [Annotation]
|
||||
extraAnoList =
|
||||
-- , (SpecificRoom . return . tToBTree $ treePost [corridor,corridor,cleatOnward corridor])
|
||||
[ AnRoom $ roomCCrits 10
|
||||
-- ]
|
||||
--
|
||||
--extraAnoList :: [Annotation]
|
||||
--extraAnoList =
|
||||
---- , (SpecificRoom . return . tToBTree $ treePost [corridor,corridor,cleatOnward corridor])
|
||||
-- [ AnRoom $ roomCCrits 10
|
||||
, AnRoom $ roomCCrits 10
|
||||
, AnTree $ tToBTree "spawners" <$> spawnerRoom
|
||||
, AnRoom pistolerRoom
|
||||
, AnRoom doubleCorridorBarrels
|
||||
|
||||
Reference in New Issue
Block a user