Introduce safeMinimumOn
This commit is contained in:
+4
-2
@@ -95,6 +95,9 @@ wallsOnCirc p r = IM.filter f
|
||||
where
|
||||
f wl = uncurry circOnSeg (_wlLine wl) p r
|
||||
|
||||
wallsOnScreen :: World -> IM.IntMap Wall
|
||||
wallsOnScreen w = wallsNearZones (zoneOfScreen w) w
|
||||
|
||||
allWalls :: World -> IM.IntMap Wall
|
||||
allWalls w = IM.unions $ concatMap IM.elems $ IM.elems $ _wallsZone w
|
||||
|
||||
@@ -202,8 +205,7 @@ reflectPointCreature p1 p2 cr = case collidePointCirc p1 p2 (_crRad cr) (_crPos
|
||||
{- | TODO: determine precisely what this does. -}
|
||||
reflectPointCreatures :: Point2 -> Point2 -> IM.IntMap Creature -> Maybe (Point2,Point2,Int)
|
||||
reflectPointCreatures p1 p2 cs
|
||||
= listToMaybe
|
||||
. sortOn f
|
||||
= safeMinimumOn f
|
||||
. IM.elems
|
||||
$ IM.mapMaybe (reflectPointCreature p1 p2) cs
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user