gameServer/HWProtoInRoomState.hs
changeset 4941 90572c338e60
parent 4932 f11d80bac7ed
child 4942 1c85a8e6e11c
equal deleted inserted replaced
4940:e247addb947c 4941:90572c338e60
    31     | otherwise = do
    31     | otherwise = do
    32         chans <- roomOthersChans
    32         chans <- roomOthersChans
    33         cl <- thisClient
    33         cl <- thisClient
    34         if isMaster cl then
    34         if isMaster cl then
    35            return [
    35            return [
    36                 ModifyRoom (\r -> r{params = Map.insert paramName paramStrs (params r)}),
    36                 ModifyRoom f,
    37                 AnswerClients chans ("CFG" : paramName : paramStrs)]
    37                 AnswerClients chans ("CFG" : paramName : paramStrs)]
    38             else
    38             else
    39             return [ProtocolError "Not room master"]
    39             return [ProtocolError "Not room master"]
       
    40     where
       
    41         f r = if paramName `Map.member` (mapParams r) then
       
    42                 r{mapParams = Map.insert paramName (head paramStrs) (mapParams r)}
       
    43                 else
       
    44                 r{params = Map.insert paramName paramStrs (params r)}
    40 
    45 
    41 handleCmd_inRoom ("ADD_TEAM" : tName : color : grave : fort : voicepack : flag : difStr : hhsInfo)
    46 handleCmd_inRoom ("ADD_TEAM" : tName : color : grave : fort : voicepack : flag : difStr : hhsInfo)
    42     | length hhsInfo /= 16 = return [ProtocolError "Corrupted hedgehogs info"]
    47     | length hhsInfo /= 16 = return [ProtocolError "Corrupted hedgehogs info"]
    43     | otherwise = do
    48     | otherwise = do
    44         (ci, _) <- ask
    49         (ci, _) <- ask