Continue bullet refactor

This commit is contained in:
2022-07-17 10:57:29 +01:00
parent 7d6407bebc
commit b860de70a7
12 changed files with 81 additions and 106 deletions
+2 -2
View File
@@ -218,7 +218,7 @@ updateFlares = flares %~ mapMaybe updateFlare
updateBullets :: World -> World
updateBullets w = updateInstantBullets $ set bullets (catMaybes ps) w'
where
(w',ps) = mapAccumR (\a b -> updateBullet a b) w $ _bullets w
(w',ps) = mapAccumR updateBullet w $ _bullets w
{- Apply internal particle updates, delete 'Nothing's. -}
updateParticles :: World -> World
@@ -298,7 +298,7 @@ intersectSegSegs' _ _ _ = Nothing
updateInstantBullets :: World -> World
updateInstantBullets w = case _instantBullets w of
[] -> w
ps -> let (w',ps') = mapAccumR (\a b -> updateBullet a b) (w {_instantBullets=[]}) ps
ps -> let (w',ps') = mapAccumR updateBullet (w {_instantBullets=[]}) ps
in updateInstantBullets $ w' & bullets .++~ catMaybes ps'
updateInstantParticles :: World -> World