Attempt to fix some space leaks, general cleanup
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
module Dodge.Creature.Update where
|
||||
module Dodge.Creature.Update
|
||||
( updateCreature
|
||||
) where
|
||||
|
||||
import Dodge.Barreloid
|
||||
import Dodge.Creature.ChainUpdates
|
||||
import Dodge.Creature.Impulse
|
||||
import Dodge.Creature.State
|
||||
import Dodge.Data.World
|
||||
import Dodge.Humanoid
|
||||
import Dodge.Lampoid
|
||||
import LensHelp
|
||||
import System.Random
|
||||
|
||||
updateCreature :: Creature -> World -> World
|
||||
updateCreature cr = case _crType cr of
|
||||
@@ -16,15 +13,3 @@ updateCreature cr = case _crType cr of
|
||||
Humanoid{} -> updateHumanoid cr
|
||||
Barreloid{} -> updateBarreloid cr
|
||||
NonDrawnCreature -> id
|
||||
|
||||
-- bit of a hack to get new random generators after each creature's update
|
||||
defaultImpulsive ::
|
||||
[World -> Creature -> Creature] ->
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
defaultImpulsive = fmap (fmap updateRandGen) . stateUpdate . impulsiveAIBefore . chainCreatureUpdates
|
||||
where
|
||||
updateRandGen w =
|
||||
let (_, g) = randomR (0, 1 :: Int) (_randGen w)
|
||||
in w & randGen .~ g
|
||||
|
||||
Reference in New Issue
Block a user