Attempt to fix some space leaks, general cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user