gameServer/EngineInteraction.hs
changeset 8483 d5fd4d7a0bcc
parent 8481 692ff6468b63
child 8484 99c14f14f788
equal deleted inserted replaced
8482:5656a73fe3c3 8483:d5fd4d7a0bcc
    54         , [eml ["e$template_filter ", mapParams Map.! "TEMPLATE"]]
    54         , [eml ["e$template_filter ", mapParams Map.! "TEMPLATE"]]
    55         , [eml ["e$mapgen ", mapgen]]
    55         , [eml ["e$mapgen ", mapgen]]
    56         , mapgenSpecific
    56         , mapgenSpecific
    57         , concatMap teamSetup teams
    57         , concatMap teamSetup teams
    58         , msgs
    58         , msgs
       
    59         , [em "!"]
    59         ]
    60         ]
    60     where
    61     where
    61         em = toEngineMsg
    62         em = toEngineMsg
    62         eml = em . B.concat
    63         eml = em . B.concat
    63         mapGenTypes = ["+rnd+", "+maze+", "+drawn+"]
    64         mapGenTypes = ["+rnd+", "+maze+", "+drawn+"]
    75             $ filter (\(_, (n, _)) -> not $ B.null n)
    76             $ filter (\(_, (n, _)) -> not $ B.null n)
    76             $ zip (drop (length gameFlagConsts) scheme) schemeParams
    77             $ zip (drop (length gameFlagConsts) scheme) schemeParams
    77         ammoStr :: B.ByteString
    78         ammoStr :: B.ByteString
    78         ammoStr = head . tail $ params Map.! "AMMO"
    79         ammoStr = head . tail $ params Map.! "AMMO"
    79         ammo = let l = B.length ammoStr `div` 4; ((a, b), (c, d)) = (B.splitAt l . fst &&& B.splitAt l . snd) . B.splitAt (l * 2) $ ammoStr in
    80         ammo = let l = B.length ammoStr `div` 4; ((a, b), (c, d)) = (B.splitAt l . fst &&& B.splitAt l . snd) . B.splitAt (l * 2) $ ammoStr in
    80                    map (\(x, y) -> eml [x, " ", y]) $ zip ["eammloadt", "eammprob", "eammdelay", "eammreinf"] [a, b, c, d]
    81                    (map (\(x, y) -> eml [x, " ", y]) $ zip ["eammloadt", "eammprob", "eammdelay", "eammreinf"] [a, b, c, d])
       
    82                    ++ [em "eammstore" | scheme !! 14 == "true" || scheme !! 20 == "false"]
       
    83         initHealth = scheme !! 27
    81         teamSetup :: TeamInfo -> [B.ByteString]
    84         teamSetup :: TeamInfo -> [B.ByteString]
    82         teamSetup _ = ammo
    85         teamSetup t = 
       
    86                 eml ["eaddteam ", teamcolor t, " ", teamowner t, " <hash>"]
       
    87                 : em "erdriven"
       
    88                 : eml ["efort ", teamfort t]
       
    89                 : replicate (hhnum t) (eml ["eaddhh 0 ", initHealth, " hedgehog"])
    83 
    90 
    84 drawnMapData :: B.ByteString -> [B.ByteString]
    91 drawnMapData :: B.ByteString -> [B.ByteString]
    85 drawnMapData = undefined
    92 drawnMapData = error "drawnMapData"
    86 
    93 
    87 schemeParams :: [(B.ByteString, Int)]
    94 schemeParams :: [(B.ByteString, Int)]
    88 schemeParams = [
    95 schemeParams = [
    89       ("e$damagepct", 1)
    96       ("e$damagepct", 1)
    90     , ("e$turntime", 1000)
    97     , ("e$turntime", 1000)