More nesting of fields in CWorld
This commit is contained in:
+9
-7
@@ -1,13 +1,15 @@
|
||||
module Dodge.Clock
|
||||
( clockCycle
|
||||
) where
|
||||
module Dodge.Clock (
|
||||
clockCycle,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.Vector as V
|
||||
import Dodge.Data.World
|
||||
|
||||
import qualified Data.Vector as V
|
||||
clockCycle :: Int -> V.Vector a -> World -> a
|
||||
{-# INLINABLE clockCycle #-}
|
||||
clockCycle tPeriod xs w = xs V.! i
|
||||
{-# INLINEABLE clockCycle #-}
|
||||
clockCycle tPeriod xs w = xs V.! i
|
||||
where
|
||||
l = V.length xs
|
||||
t = _worldClock (_cWorld w) `mod` (l * tPeriod)
|
||||
t = (w ^. cWorld . cwTime . worldClock) `mod` (l * tPeriod)
|
||||
i = t `div` tPeriod
|
||||
|
||||
Reference in New Issue
Block a user