Change foldr to foldl' in some cases

This commit is contained in:
2022-06-23 21:46:46 +01:00
parent fb3f677957
commit 89dd8502ad
6 changed files with 34 additions and 27 deletions
+2 -2
View File
@@ -151,11 +151,11 @@ zoneCreatures w = w
cid = _crID cr
updateCreatureSoundPositions :: World -> World
updateCreatureSoundPositions w = M.foldrWithKey insertSound w
updateCreatureSoundPositions w = M.foldlWithKey' insertSound w
. M.mapMaybeWithKey updateSound
$ _playingSounds w
where
insertSound k s = toPlaySounds %~ M.insertWith (const id) k s
insertSound w' k s = w' & toPlaySounds %~ M.insertWith (const id) k s
updateSound (CrMouth cid) s = case w ^? creatures . ix cid . crPos of
Just p -> Just s {_soundPos = p, _soundAngDist = Just (soundAngle p w,0)}
Nothing -> Just s {_soundTime = Just 0}