Separate out concrete part of world
This commit is contained in:
@@ -8,9 +8,9 @@ import Data.Maybe
|
||||
|
||||
updateWallDamages :: World -> World
|
||||
updateWallDamages w = w
|
||||
& wallDamages .~ IM.empty
|
||||
& flip (IM.foldrWithKey f) (_wallDamages w)
|
||||
& cWorld . wallDamages .~ IM.empty
|
||||
& flip (IM.foldrWithKey f) (_wallDamages (_cWorld w))
|
||||
where
|
||||
f k dams w' = fromMaybe w' $ do
|
||||
wl <- w' ^? walls . ix k
|
||||
wl <- w' ^? cWorld . walls . ix k
|
||||
return $ foldr (`damageWall` wl) w' dams
|
||||
|
||||
Reference in New Issue
Block a user