equal
deleted
inserted
replaced
12 --------------- |
12 --------------- |
13 import CoreTypes |
13 import CoreTypes |
14 |
14 |
15 |
15 |
16 saveReplay :: RoomInfo -> IO () |
16 saveReplay :: RoomInfo -> IO () |
17 saveReplay r = when allPlayersHaveRegisteredAccounts $ do |
17 saveReplay r = do |
18 time <- getCurrentTime |
|
19 u <- liftM hashUnique newUnique |
|
20 let fileName = "replays/" ++ show time ++ "-" ++ show u |
|
21 let gi = fromJust $ gameInfo r |
18 let gi = fromJust $ gameInfo r |
22 let replayInfo = (teamsAtStart gi, Map.toList $ mapParams r, Map.toList $ params r, roundMsgs gi) |
19 when (allPlayersHaveRegisteredAccounts gi) $ do |
23 E.catch |
20 time <- getCurrentTime |
24 (writeFile fileName (show replayInfo)) |
21 u <- liftM hashUnique newUnique |
25 (\(e :: IOException) -> warningM "REPLAYS" $ "Couldn't write to " ++ fileName ++ ": " ++ show e) |
22 let fileName = "replays/" ++ show time ++ "-" ++ show u |
|
23 let replayInfo = (teamsAtStart gi, Map.toList $ mapParams r, Map.toList $ params r, roundMsgs gi) |
|
24 E.catch |
|
25 (writeFile fileName (show replayInfo)) |
|
26 (\(e :: IOException) -> warningM "REPLAYS" $ "Couldn't write to " ++ fileName ++ ": " ++ show e) |