gameServer/HWProtoInRoomState.hs
changeset 2917 2f4320a1b31f
parent 2902 1566f05ca371
child 2928 0e95e0e24fd8
equal deleted inserted replaced
2916:31f8d418ced3 2917:2f4320a1b31f
    41     | otherwise = [ProtocolError "Not room master"]
    41     | otherwise = [ProtocolError "Not room master"]
    42     where
    42     where
    43         client = clients IntMap.! clID
    43         client = clients IntMap.! clID
    44 
    44 
    45 handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : flag : difStr : hhsInfo)
    45 handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : flag : difStr : hhsInfo)
    46     | length hhsInfo /= 16 = []
    46     | length hhsInfo == 15 && clientProto client < 30 = handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : " " : flag : difStr : hhsInfo)
       
    47     | length hhsInfo /= 16 = [ProtocolError "Corrupted hedgehogs info"]
    47     | length (teams room) == 6 = [Warning "too many teams"]
    48     | length (teams room) == 6 = [Warning "too many teams"]
    48     | canAddNumber <= 0 = [Warning "too many hedgehogs"]
    49     | canAddNumber <= 0 = [Warning "too many hedgehogs"]
    49     | isJust findTeam = [Warning "There's already a team with same name in the list"]
    50     | isJust findTeam = [Warning "There's already a team with same name in the list"]
    50     | gameinprogress room = [Warning "round in progress"]
    51     | gameinprogress room = [Warning "round in progress"]
    51     | isRestrictedTeams room = [Warning "restricted"]
    52     | isRestrictedTeams room = [Warning "restricted"]
    64         newTeam = (TeamInfo clID (nick client) name color grave fort voicepack flag difficulty newTeamHHNum (hhsList hhsInfo))
    65         newTeam = (TeamInfo clID (nick client) name color grave fort voicepack flag difficulty newTeamHHNum (hhsList hhsInfo))
    65         difficulty = fromMaybe 0 (maybeRead difStr :: Maybe Int)
    66         difficulty = fromMaybe 0 (maybeRead difStr :: Maybe Int)
    66         hhsList [] = []
    67         hhsList [] = []
    67         hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
    68         hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
    68         newTeamHHNum = min 4 canAddNumber
    69         newTeamHHNum = min 4 canAddNumber
    69 
       
    70 handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : difStr : hhsInfo) =
       
    71     handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : "" : difStr : hhsInfo)
       
    72 
       
    73 
    70 
    74 handleCmd_inRoom clID clients rooms ["REMOVE_TEAM", teamName]
    71 handleCmd_inRoom clID clients rooms ["REMOVE_TEAM", teamName]
    75     | noSuchTeam = [Warning "REMOVE_TEAM: no such team"]
    72     | noSuchTeam = [Warning "REMOVE_TEAM: no such team"]
    76     | nick client /= teamowner team = [ProtocolError "Not team owner!"]
    73     | nick client /= teamowner team = [ProtocolError "Not team owner!"]
    77     | otherwise =
    74     | otherwise =