gameServer/HWProtoInRoomState.hs
changeset 7921 6b074de32bea
parent 7862 bd76ca40db68
child 7947 0cf5277fef1a
equal deleted inserted replaced
7919:c7d258a4358e 7921:6b074de32bea
    70                 [Warning "round in progress"]
    70                 [Warning "round in progress"]
    71             else if isRestrictedTeams rm then
    71             else if isRestrictedTeams rm then
    72                 [Warning "restricted"]
    72                 [Warning "restricted"]
    73             else
    73             else
    74                 [ModifyRoom (\r -> r{teams = teams r ++ [newTeam ci clNick r teamColor]}),
    74                 [ModifyRoom (\r -> r{teams = teams r ++ [newTeam ci clNick r teamColor]}),
       
    75                 SendUpdateOnThisRoom,
    75                 ModifyClient (\c -> c{teamsInGame = teamsInGame c + 1, clientClan = Just teamColor}),
    76                 ModifyClient (\c -> c{teamsInGame = teamsInGame c + 1, clientClan = Just teamColor}),
    76                 AnswerClients clChan ["TEAM_ACCEPTED", tName],
    77                 AnswerClients clChan ["TEAM_ACCEPTED", tName],
    77                 AnswerClients othChans $ teamToNet $ newTeam ci clNick rm teamColor,
    78                 AnswerClients othChans $ teamToNet $ newTeam ci clNick rm teamColor,
    78                 AnswerClients roomChans ["TEAM_COLOR", tName, teamColor]
    79                 AnswerClients roomChans ["TEAM_COLOR", tName, teamColor]
    79                 ]
    80                 ]
   104                 [Warning "REMOVE_TEAM: no such team"]
   105                 [Warning "REMOVE_TEAM: no such team"]
   105             else if clNick /= teamowner team then
   106             else if clNick /= teamowner team then
   106                 [ProtocolError "Not team owner!"]
   107                 [ProtocolError "Not team owner!"]
   107             else
   108             else
   108                 [RemoveTeam tName,
   109                 [RemoveTeam tName,
       
   110                 SendUpdateOnThisRoom,
   109                 ModifyClient
   111                 ModifyClient
   110                     (\c -> c{
   112                     (\c -> c{
   111                         teamsInGame = teamsInGame c - 1,
   113                         teamsInGame = teamsInGame c - 1,
   112                         clientClan = if teamsInGame c == 1 then Nothing else Just $ anotherTeamClan ci r
   114                         clientClan = if teamsInGame c == 1 then Nothing else Just $ anotherTeamClan ci r
   113                     })
   115                     })
   192                     (\r -> r{
   194                     (\r -> r{
   193                         gameInfo = Just $ newGameInfo (teams rm) (length $ teams rm) allPlayersRegistered (mapParams rm) (params rm)
   195                         gameInfo = Just $ newGameInfo (teams rm) (length $ teams rm) allPlayersRegistered (mapParams rm) (params rm)
   194                         }
   196                         }
   195                     )
   197                     )
   196                 , AnswerClients chans ["RUN_GAME"]
   198                 , AnswerClients chans ["RUN_GAME"]
       
   199                 , SendUpdateOnThisRoom
   197                 , AnswerClients chans $ "CLIENT_FLAGS" : "+g" : nicks
   200                 , AnswerClients chans $ "CLIENT_FLAGS" : "+g" : nicks
   198                 , ModifyRoomClients (\c -> c{isInGame = True})
   201                 , ModifyRoomClients (\c -> c{isInGame = True})
   199                 ]
   202                 ]
   200             else
   203             else
   201             return [Warning "Less than two clans!"]
   204             return [Warning "Less than two clans!"]