Fix space leak when assigning targeted creature

This commit is contained in:
2021-12-10 02:56:14 +00:00
parent e5db9ba5d0
commit 15e1fbc060
7 changed files with 33 additions and 18 deletions
+3 -2
View File
@@ -46,7 +46,8 @@ stateUpdate :: CRUpdate -> Creature -> World -> World
stateUpdate f cr w = let (fw,mcr) = stateUpdateDamage doDamage f cr w
in fw $ w & creatures . at (_crID cr) .~ mcr
stateUpdate' :: CRUpdate' -> Creature -> World -> World
stateUpdate' :: (Creature -> World -> (World -> World, Creature))
-> Creature -> World -> World
stateUpdate' f cr w = let (fw,mcr) = stateUpdateDamage' doDamage f cr w
in fw $ w & creatures . at (_crID cr) .~ mcr
@@ -73,7 +74,7 @@ stateUpdateDamage' :: (Creature -> Creature) -> CRUpdate' -> CRUpdate
stateUpdateDamage' damageupdate u cr w = case u (updateMovement cr) w of
(f, upcr) ->
( invSideEff upcr . movementSideEff cr . deathEff . f
, (stepReloading . damageupdate) <$> crOrCorpse upcr
, stepReloading . damageupdate <$> crOrCorpse upcr
)
where
crOrCorpse cr'