Move streaming data into its own file

This commit is contained in:
2022-06-29 08:05:20 +01:00
parent b1a7e1bf35
commit 5501d6f9b5
12 changed files with 25 additions and 38 deletions
+4 -23
View File
@@ -98,11 +98,8 @@ functionalUpdate cfig w = checkEndGame
zoneClouds :: World -> World
zoneClouds w = w & clZoning %~ \zn ->
foldl' (flip $ insertInZoning (:)) (zn & znObjects .~ mempty) (_clouds w)
-- where
-- cloudInZone cl = insertInZoneWith p (++) [cl]
-- where
-- p = clZoneOfPoint $ stripZ $ _clPos cl
foldl' (flip $ updateZoning (:)) (zn & znObjects .~ mempty) (_clouds w)
--runIdentity (S.fold_ (flip $ updateZoning (:)) (zn & znObjects .~ mempty) id (_clouds w))
updateWorldSelect :: World -> World
updateWorldSelect w = case w ^? mouseButtons . ix ButtonLeft of
@@ -150,25 +147,8 @@ doRewind w = case _maybeWorld w of
zoneCreatures :: World -> World
zoneCreatures w = w & crZoning %~ \zn ->
foldl' (flip $ insertInZoning (\cr -> IM.insert (_crID cr) cr))
foldl' (flip $ updateZoning (\cr -> IM.insert (_crID cr) cr))
(zn & znObjects .~ mempty) (_creatures w)
-- . znObjects .~
-- IM.foldl' zoneCreature IM.empty (_creatures w)
---- runIdentity (S.fold_ zoneCreature IM.empty id (S.each $ _creatures w))
--
--zoneCreature :: IM.IntMap (IM.IntMap (IM.IntMap Creature))
-- -> Creature
-- -> IM.IntMap (IM.IntMap (IM.IntMap Creature))
--zoneCreature m cr = runIdentity $ S.fold_ doinsert m id (zoneOfCreature cr)
-- where
-- doinsert m' (V2 x y) = insertIMInZone x y (_crID cr) cr m'
-- IM.foldl' (flip creatureInZone) IM.empty (_creatures w)
-- where
-- creatureInZone cr = insertIMInZone x y cid cr
-- where
-- V2 x y = crZoneOfPoint $ _crPos cr
-- cid = _crID cr
updateCreatureSoundPositions :: World -> World
updateCreatureSoundPositions w = M.foldlWithKey' insertSound w
@@ -338,6 +318,7 @@ mvGust _ gu
updateClouds :: World -> World
updateClouds w = w' & clouds .~ catMaybes mclouds
where
-- cls = _clouds w
(w',mclouds) = mapAccumR updateCloud w (_clouds w)
updateCloud :: World -> Cloud -> (World,Maybe Cloud)