Cleanup
This commit is contained in:
@@ -2,7 +2,6 @@ module Dodge.Update.WallDamage (updateWallDamages, updateEdgesWall) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Foldable
|
||||
import Data.Maybe
|
||||
import Data.Monoid
|
||||
import qualified Data.Set as S
|
||||
import Dodge.Data.World
|
||||
@@ -13,23 +12,12 @@ import Dodge.Zoning.Base
|
||||
import Geometry.Data
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
--updateWallDamages :: World -> World
|
||||
--updateWallDamages w =
|
||||
-- let (is, w') = IM.foldlWithKey' f (mempty, w) (w ^. cWorld . lWorld . wallDamages)
|
||||
-- in updateEdgesWall is w' & cWorld . lWorld . wallDamages .~ IM.empty
|
||||
-- where
|
||||
-- f isw k dams = fromMaybe isw $ do
|
||||
-- wl <- isw ^? _2 . cWorld . lWorld . walls . ix k
|
||||
-- return $ foldl' (flip (`damageWall` wl)) isw dams
|
||||
|
||||
updateWallDamages :: World -> World
|
||||
updateWallDamages w = set (cWorld . lWorld . wallDamages) mempty
|
||||
. uncurry updateEdgesWall $ foldrM f w
|
||||
(IM.toList $ w ^. cWorld . lWorld . wallDamages)
|
||||
where
|
||||
f (k,dams) w' = fromMaybe (mempty,w') $ do
|
||||
wl <- w' ^? cWorld . lWorld . walls . ix k
|
||||
return $ foldrM (damageWall wl) w' dams
|
||||
f (k,dams) w' = foldrM (damageWall k) w' dams
|
||||
|
||||
updateEdgesWall :: S.Set Int2 -> World -> World
|
||||
updateEdgesWall is w =
|
||||
|
||||
Reference in New Issue
Block a user