Various performance improvements

This commit is contained in:
2021-09-23 15:27:37 +01:00
parent 7b6904b51f
commit 85edd98d62
17 changed files with 137 additions and 81 deletions
+5 -4
View File
@@ -2,6 +2,11 @@
Find which objects lie upon a line.
-}
module Dodge.WorldEvent.ThingsHit
( thingsHit
, thingsHitLongLine
, thingsHitExceptCr
, thingsHitExceptCrLongLine
)
where
import Dodge.Data
import Dodge.Base
@@ -80,7 +85,3 @@ thingsHitLongLine sp ep w
hitPoint wl = uncurry (intersectSegSeg sp ep) (_wlLine wl)
hitFFs = mapMaybe (collidePointFF sp ep (_randGen w)) (IM.elems $ _forceFields w)
ffs = map (\(p,(_,i)) -> (p, E3x3 $ _forceFields w IM.! i)) hitFFs
thingsHitOnPath :: [Point2] -> World -> [ [ ( Point2, Either3 Creature Wall ForceField ) ] ]
thingsHitOnPath [] _ = error "tried to find thingsHitOnPath containing no points"
thingsHitOnPath ps w = zipWith (\ a b -> thingsHit a b w) ps $ tail ps