From f873b679aa5b1da1c9be962343d8e8d3dcdc5389 Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 23 Feb 2023 16:59:09 +0000 Subject: [PATCH] Tweaks before attempting to move zoning out of LWorld --- src/Dodge/Combine.hs | 1 - src/Dodge/Update.hs | 16 ++-------------- src/Dodge/Zoning/Base.hs | 1 + 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/Dodge/Combine.hs b/src/Dodge/Combine.hs index 19a3a41a7..ca46bdc75 100644 --- a/src/Dodge/Combine.hs +++ b/src/Dodge/Combine.hs @@ -100,4 +100,3 @@ combineTwoModuleMaps = fullModuleName :: ItemModuleType -> String fullModuleName = fromMaybe "EMPTYMODULE" . moduleName - diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index de47ca501..0732743f6 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -244,16 +244,6 @@ functionalUpdate w = -- . over uvWorld updateInventorySelectionList $ over (uvWorld . cWorld) updatePastWorlds w ---updateInventorySelectionList :: World -> World ---updateInventorySelectionList w = w --- & cWorld . lWorld . hud . hudElement . augmentedInventory .~ makeInventorySelectionList w - --- this can probably be unified with updateWheelEvents - ---updateWheelEvents :: World -> World ---updateWheelEvents w = foldr ($) w (replicate (abs y) (updateWheelEvent (signum y))) --- where --- y = w ^. input . scrollAmount updateWheelEvents :: World -> World updateWheelEvents w | yi == 0 = w @@ -368,10 +358,8 @@ setOldPos cr = -- Nothing' -> w & timeFlow .~ NormalTimeFlow zoneCreatures :: World -> World -zoneCreatures w = - w - & cWorld . lWorld . crZoning .~ mempty - & cWorld . lWorld . crZoning %~ \zn -> foldl' (flip zoneCreature) zn (w ^. cWorld . lWorld . creatures) +zoneCreatures w = w & cWorld . lWorld . crZoning + .~ foldl' (flip zoneCreature) mempty (w ^. cWorld . lWorld . creatures) -- foldl' (flip $ updateZoning (\cr -> IM.insert (_crID cr) cr)) -- zn (_creatures w) diff --git a/src/Dodge/Zoning/Base.hs b/src/Dodge/Zoning/Base.hs index 731d45fe7..8a8fde7de 100644 --- a/src/Dodge/Zoning/Base.hs +++ b/src/Dodge/Zoning/Base.hs @@ -78,6 +78,7 @@ yIntercepts' s sp ep = map f $ xIntercepts s (f sp) (f ep) f (V2 x y) = V2 y x zoneMonoid :: Semigroup m => Int2 -> m -> IM.IntMap (IM.IntMap m) -> IM.IntMap (IM.IntMap m) +{-# INLINE zoneMonoid #-} zoneMonoid (V2 x y) a = IM.insertWith f x $! IM.singleton y a where f _ = IM.insertWith (<>) y a