equal
deleted
inserted
replaced
4 import qualified Data.List as List |
4 import qualified Data.List as List |
5 import Control.Monad |
5 import Control.Monad |
6 import qualified Codec.Binary.Base64 as Base64 |
6 import qualified Codec.Binary.Base64 as Base64 |
7 import qualified Data.ByteString.Char8 as B |
7 import qualified Data.ByteString.Char8 as B |
8 import qualified Data.ByteString as BW |
8 import qualified Data.ByteString as BW |
9 |
9 ------------- |
|
10 import CoreTypes |
10 |
11 |
11 |
12 |
12 toEngineMsg :: B.ByteString -> B.ByteString |
13 toEngineMsg :: B.ByteString -> B.ByteString |
13 toEngineMsg msg = B.pack $ Base64.encode (fromIntegral (BW.length msg) : BW.unpack msg) |
14 toEngineMsg msg = B.pack $ Base64.encode (fromIntegral (BW.length msg) : BW.unpack msg) |
14 |
15 |
28 check (Just ms) | B.length ms > 0 = let m = B.head ms in (m `Set.member` legalMessages, m == '+') |
29 check (Just ms) | B.length ms > 0 = let m = B.head ms in (m `Set.member` legalMessages, m == '+') |
29 | otherwise = (False, False) |
30 | otherwise = (False, False) |
30 legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghbc12345" ++ slotMessages |
31 legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghbc12345" ++ slotMessages |
31 slotMessages = "\128\129\130\131\132\133\134\135\136\137\138" |
32 slotMessages = "\128\129\130\131\132\133\134\135\136\137\138" |
32 |
33 |
|
34 gameInfo2Replay :: GameInfo -> B.ByteString |
|
35 gameInfo2Replay GameInfo{roundMsgs = rm, |
|
36 teamsAtStart = teams, |
|
37 params1 = giMapParams, |
|
38 params2 = giParams} = do |
|
39 |