Attempt to fix some space leaks, general cleanup

This commit is contained in:
2022-08-23 23:00:12 +01:00
parent 9f00e67298
commit e7e20277e4
12 changed files with 71 additions and 263 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ moveZoomCamera uv =
wallZoom = min4 (w ^. cWorld . cwCam . cwcBoundDist)
min4 (a, b, c, d) = minimum [hh / maxd a, hh / maxd (- b), hw / maxd c, hw / maxd (- d)]
maxd = max distFromEqmnt
distFromEqmnt = foldr max 1 $ IM.mapMaybe (_eeViewDist . _equipEffect . _itUse) $ getCrEquipment $ you w
distFromEqmnt = foldl' max 1 $ IM.mapMaybe (_eeViewDist . _equipEffect . _itUse) $ getCrEquipment $ you w
hw = halfWidth cfig
hh = halfHeight cfig
-- = maybe clipZoom zoomFromItem (yourItem w ^? itZoom) wallZoom
+4 -3
View File
@@ -5,13 +5,14 @@ import Data.Maybe
import Dodge.Data.World
import Dodge.Wall.Damage
import qualified IntMapHelp as IM
import Data.Foldable
updateWallDamages :: World -> World
updateWallDamages w =
w
& cWorld . wallDamages .~ IM.empty
& flip (IM.foldrWithKey f) (_wallDamages (_cWorld w))
& flip (IM.foldlWithKey' f) (_wallDamages (_cWorld w))
where
f k dams w' = fromMaybe w' $ do
f w' k dams = fromMaybe w' $ do
wl <- w' ^? cWorld . walls . ix k
return $ foldr (`damageWall` wl) w' dams
return $ foldl' (flip (`damageWall` wl)) w' dams