gameServer/EngineInteraction.hs
changeset 10777 18afcfaa4d5a
parent 10760 fcef7d62d3c4
child 10779 d85fe0cb5df2
equal deleted inserted replaced
10776:56e401fb45ea 10777:18afcfaa4d5a
   122         mapGenTypes = ["+rnd+", "+maze+", "+drawn+"]
   122         mapGenTypes = ["+rnd+", "+maze+", "+drawn+"]
   123         maybeScript = let s = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
   123         maybeScript = let s = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
   124         maybeMap = let m = mParams Map.! "MAP" in if m `elem` mapGenTypes then [] else [eml ["emap ", m]]
   124         maybeMap = let m = mParams Map.! "MAP" in if m `elem` mapGenTypes then [] else [eml ["emap ", m]]
   125         scheme = tail $ prms Map.! "SCHEME"
   125         scheme = tail $ prms Map.! "SCHEME"
   126         mapgen = mParams Map.! "MAPGEN"
   126         mapgen = mParams Map.! "MAPGEN"
       
   127         templateFilterMsg = eml ["e$maze_size ", mParams Map.! "MAZE_SIZE"]
   127         mapgenSpecific = case mapgen of
   128         mapgenSpecific = case mapgen of
   128             "1" -> [eml ["e$maze_size ", mParams Map.! "MAZE_SIZE"]]
   129             "3" -> let d = head . fromMaybe [""] $ Map.lookup "DRAWNMAP" prms in if BW.length d <= 4 then [] else drawnMapData d
   129             "2" -> let d = head . fromMaybe [""] $ Map.lookup "DRAWNMAP" prms in if BW.length d <= 4 then [] else drawnMapData d
   130             _ -> [templateFilterMsg]
   130             _ -> []
       
   131         gameFlags :: Word32
   131         gameFlags :: Word32
   132         gameFlags = foldl (\r (b, f) -> if b == "false" then r else r .|. f) 0 $ zip scheme gameFlagConsts
   132         gameFlags = foldl (\r (b, f) -> if b == "false" then r else r .|. f) 0 $ zip scheme gameFlagConsts
   133         schemeFlags = map (\(v, (n, m)) -> eml [n, " ", showB $ (readInt_ v) * m])
   133         schemeFlags = map (\(v, (n, m)) -> eml [n, " ", showB $ (readInt_ v) * m])
   134             $ filter (\(_, (n, _)) -> not $ B.null n)
   134             $ filter (\(_, (n, _)) -> not $ B.null n)
   135             $ zip (drop (length gameFlagConsts) scheme) schemeParams
   135             $ zip (drop (length gameFlagConsts) scheme) schemeParams