gameServer/EngineInteraction.hs
branchsdl2transition
changeset 9798 f2b18754742f
parent 9690 6a1748b71df2
child 10017 de822cd3df3a
child 10027 403b86a1d05f
equal deleted inserted replaced
9711:7d0329f37181 9798:f2b18754742f
    10 import qualified Data.Map as Map
    10 import qualified Data.Map as Map
    11 import qualified Data.List as L
    11 import qualified Data.List as L
    12 import Data.Word
    12 import Data.Word
    13 import Data.Bits
    13 import Data.Bits
    14 import Control.Arrow
    14 import Control.Arrow
       
    15 import Data.Maybe
    15 -------------
    16 -------------
    16 import CoreTypes
    17 import CoreTypes
    17 import Utils
    18 import Utils
    18 
    19 
    19 
    20 
    72         ]
    73         ]
    73     where
    74     where
    74         em = toEngineMsg
    75         em = toEngineMsg
    75         eml = em . B.concat
    76         eml = em . B.concat
    76         mapGenTypes = ["+rnd+", "+maze+", "+drawn+"]
    77         mapGenTypes = ["+rnd+", "+maze+", "+drawn+"]
    77         maybeScript = let s = head $ prms Map.! "SCRIPT" in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
    78         maybeScript = let s = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
    78         maybeMap = let m = mParams Map.! "MAP" in if m `elem` mapGenTypes then [] else [eml ["emap ", m]]
    79         maybeMap = let m = mParams Map.! "MAP" in if m `elem` mapGenTypes then [] else [eml ["emap ", m]]
    79         scheme = tail $ prms Map.! "SCHEME"
    80         scheme = tail $ prms Map.! "SCHEME"
    80         mapgen = mParams Map.! "MAPGEN"
    81         mapgen = mParams Map.! "MAPGEN"
    81         mapgenSpecific = case mapgen of
    82         mapgenSpecific = case mapgen of
    82             "+maze+" -> [eml ["e$maze_size ", head $ prms Map.! "MAZE_SIZE"]]
    83             "+maze+" -> [eml ["e$maze_size ", head $ prms Map.! "MAZE_SIZE"]]