equal
deleted
inserted
replaced
10 import Data.Unique |
10 import Data.Unique |
11 import Control.Monad |
11 import Control.Monad |
12 import Data.List |
12 import Data.List |
13 import qualified Data.ByteString as B |
13 import qualified Data.ByteString as B |
14 import System.Directory |
14 import System.Directory |
|
15 import Control.DeepSeq |
15 --------------- |
16 --------------- |
16 import CoreTypes |
17 import CoreTypes |
17 import EngineInteraction |
18 import EngineInteraction |
18 |
19 |
19 |
20 |
53 loadFile fileName = E.handle (\(e :: SomeException) -> |
54 loadFile fileName = E.handle (\(e :: SomeException) -> |
54 warningM "REPLAYS" ("Problems reading " ++ fileName ++ ": " ++ show e) >> return (Nothing, [])) $ do |
55 warningM "REPLAYS" ("Problems reading " ++ fileName ++ ": " ++ show e) >> return (Nothing, [])) $ do |
55 (teams, params1, params2, roundMsgs) <- liftM read $ readFile fileName |
56 (teams, params1, params2, roundMsgs) <- liftM read $ readFile fileName |
56 return $ ( |
57 return $ ( |
57 Just (CheckInfo fileName teams) |
58 Just (CheckInfo fileName teams) |
58 , replayToDemo teams (Map.fromList params1) (Map.fromList params2) (reverse roundMsgs) |
59 , let d = replayToDemo teams (Map.fromList params1) (Map.fromList params2) (reverse roundMsgs) in d `deepseq` d |
59 ) |
60 ) |
60 |
61 |
61 moveFailedRecord :: String -> IO () |
62 moveFailedRecord :: String -> IO () |
62 moveFailedRecord fn = E.handle (\(e :: SomeException) -> warningM "REPLAYS" $ show e) $ |
63 moveFailedRecord fn = E.handle (\(e :: SomeException) -> warningM "REPLAYS" $ show e) $ |
63 renameFile fn ("failed/" ++ drop 8 fn) |
64 renameFile fn ("failed/" ++ drop 8 fn) |