Cleanup
This commit is contained in:
@@ -28,13 +28,7 @@ import Geometry
|
||||
import qualified ListHelp as List
|
||||
|
||||
{- List those objects that appear on a line. -}
|
||||
thingsHit ::
|
||||
-- | Line start point
|
||||
Point2 ->
|
||||
-- | Line end point
|
||||
Point2 ->
|
||||
World ->
|
||||
[(Point2, Either Creature Wall)]
|
||||
thingsHit :: Point2 -> Point2 -> World -> [(Point2, Either Creature Wall)]
|
||||
thingsHit sp ep w =
|
||||
List.mergeOn
|
||||
(dist sp . fst)
|
||||
@@ -68,7 +62,8 @@ thingHit :: Point2 -> Point2 -> World -> Maybe (Point2, Either Creature Wall)
|
||||
thingHit sp ep = listToMaybe . thingsHit sp ep
|
||||
|
||||
crHit :: Point2 -> Point2 -> World -> Maybe (Point2,Creature)
|
||||
crHit sp ep = listToMaybe . sortOn (dist sp . fst) . crsHit sp ep
|
||||
--crHit sp ep = listToMaybe . sortOn (dist sp . fst) . crsHit sp ep
|
||||
crHit sp ep = listToMaybe . crsHit sp ep
|
||||
|
||||
{- List objects that appear on a line.
|
||||
Can filter out a creature. -}
|
||||
@@ -82,10 +77,9 @@ thingsHitExceptCr ::
|
||||
World ->
|
||||
[(Point2, Either Creature Wall)]
|
||||
thingsHitExceptCr Nothing sp ep = thingsHit sp ep
|
||||
thingsHitExceptCr (Just cid) sp ep = filter crNotCid . thingsHit sp ep
|
||||
thingsHitExceptCr (Just cid) sp ep = filter t . thingsHit sp ep
|
||||
where
|
||||
crNotCid (_, Left cr) = _crID cr /= cid
|
||||
crNotCid _ = True
|
||||
t = (Just cid /=) . (^? _2 . _Left . crID)
|
||||
|
||||
wlsHit :: Point2 -> Point2 -> World -> [(Point2, Wall)]
|
||||
wlsHit sp ep
|
||||
|
||||
Reference in New Issue
Block a user