gameServer/HWProtoInRoomState.hs
changeset 7321 57bd4f201401
parent 7266 74ad631a72bf
child 7537 833a0c34fafc
equal deleted inserted replaced
7319:c4705bca9f21 7321:57bd4f201401
    77         dif = readInt_ difStr
    77         dif = readInt_ difStr
    78         hhsList [] = []
    78         hhsList [] = []
    79         hhsList [_] = error "Hedgehogs list with odd elements number"
    79         hhsList [_] = error "Hedgehogs list with odd elements number"
    80         hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
    80         hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
    81         newTeamHHNum r = min 4 (canAddNumber r)
    81         newTeamHHNum r = min 4 (canAddNumber r)
    82         maxTeams r 
    82         maxTeams r
    83             | roomProto r < 38 = 6
    83             | roomProto r < 38 = 6
    84             | otherwise = 8
    84             | otherwise = 8
    85                 
    85 
    86 
    86 
    87 handleCmd_inRoom ["REMOVE_TEAM", tName] = do
    87 handleCmd_inRoom ["REMOVE_TEAM", tName] = do
    88         (ci, _) <- ask
    88         (ci, _) <- ask
    89         r <- thisRoom
    89         r <- thisRoom
    90         clNick <- clientNick
    90         clNick <- clientNick
   169 handleCmd_inRoom ["START_GAME"] = do
   169 handleCmd_inRoom ["START_GAME"] = do
   170     (ci, rnc) <- ask
   170     (ci, rnc) <- ask
   171     cl <- thisClient
   171     cl <- thisClient
   172     rm <- thisRoom
   172     rm <- thisRoom
   173     chans <- roomClientsChans
   173     chans <- roomClientsChans
   174     
   174 
   175     let allPlayersRegistered = all ((<) 0 . B.length . webPassword . client rnc . teamownerId) $ teams rm
   175     let allPlayersRegistered = all ((<) 0 . B.length . webPassword . client rnc . teamownerId) $ teams rm
   176 
   176 
   177     if isMaster cl && playersIn rm == readyPlayers rm && not (isJust $ gameInfo rm) then
   177     if isMaster cl && playersIn rm == readyPlayers rm && not (isJust $ gameInfo rm) then
   178         if enoughClans rm then
   178         if enoughClans rm then
   179             return [
   179             return [
   245 handleCmd_inRoom ["ROOM_NAME", newName] = do
   245 handleCmd_inRoom ["ROOM_NAME", newName] = do
   246     cl <- thisClient
   246     cl <- thisClient
   247     rs <- allRoomInfos
   247     rs <- allRoomInfos
   248     rm <- thisRoom
   248     rm <- thisRoom
   249     chans <- sameProtoChans
   249     chans <- sameProtoChans
   250     
   250 
   251     return $
   251     return $
   252         if not $ isMaster cl then
   252         if not $ isMaster cl then
   253             [ProtocolError "Not room master"]
   253             [ProtocolError "Not room master"]
   254         else
   254         else
   255         if isJust $ find (\r -> newName == name r) rs then
   255         if isJust $ find (\r -> newName == name r) rs then