gameServer/HWProtoInRoomState.hs
changeset 4989 4771fed9272e
parent 4986 33fe91b2bcbf
child 5030 42746c5d4a80
equal deleted inserted replaced
4988:bd540ba66599 4989:4771fed9272e
    13 import Actions
    13 import Actions
    14 import Utils
    14 import Utils
    15 import HandlerUtils
    15 import HandlerUtils
    16 import RoomsAndClients
    16 import RoomsAndClients
    17 
    17 
    18 handleCmd_inRoom :: CmdHandler c
    18 handleCmd_inRoom :: CmdHandler
    19 
    19 
    20 handleCmd_inRoom ["CHAT", msg] = do
    20 handleCmd_inRoom ["CHAT", msg] = do
    21     n <- clientNick
    21     n <- clientNick
    22     s <- roomOthersChans
    22     s <- roomOthersChans
    23     return [AnswerClients s ["CHAT", n, msg]]
    23     return [AnswerClients s ["CHAT", n, msg]]
    97             else
    97             else
    98                 [RemoveTeam tName,
    98                 [RemoveTeam tName,
    99                 ModifyClient
    99                 ModifyClient
   100                     (\c -> c{
   100                     (\c -> c{
   101                         teamsInGame = teamsInGame c - 1,
   101                         teamsInGame = teamsInGame c - 1,
   102                             clientClan = if teamsInGame c == 1 then Nothing else Just $ anotherTeamClan ci r
   102                         clientClan = if teamsInGame c == 1 then Nothing else Just $ anotherTeamClan ci r
   103                         })
   103                     })
   104                 ]
   104                 ]
   105     where
   105     where
   106         anotherTeamClan ci = teamcolor . fromJust . find (\t -> teamownerId t == ci) . teams
   106         anotherTeamClan ci = teamcolor . fromJust . find (\t -> teamownerId t == ci) . teams
   107         findTeam = find (\t -> tName == teamname t) . teams
   107         findTeam = find (\t -> tName == teamname t) . teams
   108 
   108