Remove space leak on autoDoorPane (hopefully)

This commit is contained in:
jgk
2021-03-05 15:27:47 +01:00
parent e6a569a966
commit fdca8a8760
+7 -3
View File
@@ -22,6 +22,8 @@ import Picture
import System.Random
import Control.DeepSeq (deepseq)
import Control.Monad.State
import Data.List
import Data.Function
@@ -448,8 +450,8 @@ mvPointTowardAtSpeed speed !ep !p
| otherwise = p +.+ speed *.* normalizeV (ep -.- p)
mvPointToward :: Point2 -> Point2 -> Point2
mvPointToward ep p | dist p ep < 1 = ep
| otherwise = p +.+ normalizeV (ep -.- p)
mvPointToward !ep !p | dist p ep < 1 = ep
| otherwise = p +.+ normalizeV (ep -.- p)
drawAutoDoor :: Wall -> Drawing
drawAutoDoor wl = onLayerL [levLayer WlLayer, layer2]
@@ -488,7 +490,9 @@ autoDoorPane trigL n castShad closedPos openPos = AutoDoor
$ over walls (IM.adjust closeDoor n) w
mvP !ep !p = mvPointTowardAtSpeed 2 ep p
moveToward :: [Point2] -> Wall -> Wall
moveToward ps w = w & wlLine %~ zipWith mvP ps
moveToward !ps w = let !newPs = zipWith mvP ps $ _wlLine w
in deepseq newPs $ w {_wlLine = newPs}
--deepseq ps $ w & wlLine %~ zipWith mvP ps
openDoor = moveToward openPos
closeDoor = moveToward closedPos
zoneps | dist a b <= 2 * zoneSize = [zoneOfPoint $ pHalf a b]