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
+7
View File
@@ -1,6 +1,7 @@
--{-# LANGUAGE TupleSections #-}
module Dodge.Creature.Perception
( perceptionUpdate
, perceptionUp
, perceptionUpdate'
, newSounds
)
@@ -36,6 +37,12 @@ perceptionUpdate'
-> Creature
-> Creature
perceptionUpdate' is w cr = rememberSounds' w $ basicAwarenessUpdate' $ basicAttentionUpdate' is w cr
--perceptionUpdate' is w cr = basicAwarenessUpdate' $ basicAttentionUpdate' is w cr
perceptionUp :: Int -> World -> Creature -> Creature
perceptionUp i w cr | canSee i (_crID cr) w = cr & crPerception . crAwarenessLevel . at i ?~ Cognizant 100
| otherwise = cr & crPerception . crAwarenessLevel . at i .~ Nothing
{- | Update a creatures awareness based upon the creatures' current direction
of attention -}