equal
deleted
inserted
replaced
|
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 |