Refactor, try to limit dependencies
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
module Dodge.Zone.Object where
|
||||
import Dodge.Data
|
||||
import Geometry.Zone
|
||||
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Data.Wall
|
||||
import Geometry.Data
|
||||
import StreamingHelp
|
||||
import Geometry.Zone
|
||||
import qualified Streaming.Prelude as S
|
||||
import StreamingHelp
|
||||
|
||||
zoneOfCreature :: Float -> Creature -> StreamOf Int2
|
||||
zoneOfCreature x cr = zoneInsideCirc x (_crPos cr) (_crRad cr)
|
||||
|
||||
+14
-12
@@ -1,12 +1,12 @@
|
||||
module Dodge.Zone.Update
|
||||
( updateZoning
|
||||
) where
|
||||
module Dodge.Zone.Update (
|
||||
updateZoning,
|
||||
) where
|
||||
|
||||
import Dodge.Data.Zoning
|
||||
import StreamingHelp
|
||||
import qualified Streaming.Prelude as S
|
||||
import qualified IntMapHelp as IM
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
import qualified Streaming.Prelude as S
|
||||
|
||||
updateZoning :: Monoid (t a) => (a -> t a -> t a) -> a -> Zoning t a -> Zoning t a
|
||||
{-# INLINE updateZoning #-}
|
||||
@@ -14,12 +14,14 @@ updateZoning f obj zn = runIdentity (S.fold_ doinsert zn id (_znFunc zn (_znSize
|
||||
where
|
||||
doinsert znobs vxy = insertInZoneWith vxy (\_ -> f obj) (f obj mempty) znobs
|
||||
|
||||
insertInZoneWith
|
||||
:: Int2
|
||||
-> (t a -> t a -> t a) -- ^ Combining function
|
||||
-> t a -- ^ Value to insert
|
||||
-> Zoning t a
|
||||
-> Zoning t a
|
||||
insertInZoneWith ::
|
||||
Int2 ->
|
||||
-- | Combining function
|
||||
(t a -> t a -> t a) ->
|
||||
-- | Value to insert
|
||||
t a ->
|
||||
Zoning t a ->
|
||||
Zoning t a
|
||||
{-# INLINE insertInZoneWith #-}
|
||||
insertInZoneWith (V2 x y) fun obj = over znObjects $ IM.insertWith f x $ IM.singleton y obj
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user