gameServer/HWProtoInRoomState.hs
changeset 6738 dd98869d74b4
parent 6721 7dbf8a0c1f5d
child 6753 e95b1f62d0de
equal deleted inserted replaced
6737:ce5fbd98370f 6738:dd98869d74b4
   209     clId <- asks fst
   209     clId <- asks fst
   210     cl <- thisClient
   210     cl <- thisClient
   211     rm <- thisRoom
   211     rm <- thisRoom
   212     chans <- roomClientsChans
   212     chans <- roomClientsChans
   213 
   213 
   214     if isMaster cl && isCorrect && (isJust $ gameInfo rm) then
   214     if isJust $ gameInfo rm then
   215         return $
   215         if isMaster cl && isCorrect then
   216             SaveReplay
   216             return $
   217             : ModifyRoom
   217                 SaveReplay
   218                 (\r -> r{
   218                 : ModifyRoom
   219                     gameInfo = Nothing,
   219                     (\r -> r{
   220                     readyPlayers = 0
   220                         gameInfo = Nothing,
   221                     }
   221                         readyPlayers = 0
   222                 )
   222                         }
   223             : UnreadyRoomClients
   223                     )
   224             : answerRemovedTeams chans rm
   224                 : UnreadyRoomClients
   225         else
   225                 : answerRemovedTeams chans rm
   226         return [RemoveClientTeams clId]
   226             else if not isCorrect then
       
   227                 return [RemoveClientTeams clId]
       
   228                 else
       
   229                 return []
       
   230         else
       
   231         return []
   227     where
   232     where
   228         answerRemovedTeams chans = map (\t -> AnswerClients chans ["REMOVE_TEAM", t]) . leftTeams . fromJust . gameInfo
   233         answerRemovedTeams chans = map (\t -> AnswerClients chans ["REMOVE_TEAM", t]) . leftTeams . fromJust . gameInfo
   229         isCorrect = correctly == "1"
   234         isCorrect = correctly == "1"
   230 
   235 
   231 -- compatibility with clients with protocol < 38
   236 -- compatibility with clients with protocol < 38