Store past damages in vector form

This commit is contained in:
jgk
2021-08-19 01:41:56 +02:00
parent b9f73d255f
commit d7047c4b09
7 changed files with 22 additions and 8 deletions
+4 -2
View File
@@ -24,6 +24,7 @@ import qualified SDL.Mixer as Mix
import Data.Maybe
import qualified Data.IntMap.Strict as IM
import qualified Data.Map as M
import qualified Data.Vector.Fusion.Stream.Monadic as VS
import Control.Monad
import Control.Monad.Trans
import Control.Monad.Trans.Maybe
@@ -147,8 +148,9 @@ playIfFree c times = do
As for 'playSoundQueue', but with positional information in the form of an Int16.
-}
playPositionalSoundQueue :: IM.IntMap Mix.Chunk -> [(Int,Int16)] -> IO ()
playPositionalSoundQueue chunkMap ns = forM_ ns $ \(n,a) ->
runMaybeT $ playIfFree (chunkMap IM.! n) Mix.Once >>= setChannelPos a
playPositionalSoundQueue chunkMap = VS.mapM_ ( \(n,a) ->
runMaybeT $ playIfFree (chunkMap IM.! n) Mix.Once >>= setChannelPos a )
. VS.fromList
setChannelPos :: Int16 -> Mix.Channel -> MaybeT IO Mix.Channel
setChannelPos a i = do