gameServer/OfficialServer/GameReplayStore.hs
changeset 5143 649d87819682
child 5996 2c72fe81dd37
equal deleted inserted replaced
5142:cb822f8d52ff 5143:649d87819682
       
     1 {-# LANGUAGE ScopedTypeVariables #-}
       
     2 module OfficialServer.GameReplayStore where
       
     3 
       
     4 import CoreTypes
       
     5 import Data.Time
       
     6 import Control.Exception as E
       
     7 import qualified Data.Map as Map
       
     8 import Data.Sequence()
       
     9 import System.Log.Logger
       
    10 
       
    11 saveReplay :: RoomInfo -> IO ()
       
    12 saveReplay r = do
       
    13     time <- getCurrentTime
       
    14     let fileName = "replays/" ++ show time
       
    15     let replayInfo = (teamsAtStart r, Map.toList $ mapParams r, Map.toList $ params r, roundMsgs r)
       
    16     E.catch
       
    17         (writeFile fileName (show replayInfo))
       
    18         (\(e :: IOException) -> warningM "REPLAYS" $ "Couldn't write to " ++ fileName ++ ": " ++ show e)
       
    19