gameServer/HWProtoInRoomState.hs
changeset 6756 344d32bb1328
parent 6753 e95b1f62d0de
child 6758 26bf919aeb57
equal deleted inserted replaced
6755:788bb2e0db21 6756:344d32bb1328
   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 [
   180                 ModifyRoom
   180                 ModifyRoom
   181                     (\r -> r{
   181                     (\r -> r{
   182                         gameInfo = Just $ newGameInfo (teams rm) allPlayersRegistered (mapParams rm) (params rm)
   182                         gameInfo = Just $ newGameInfo (teams rm) (length $ teams rm) allPlayersRegistered (mapParams rm) (params rm)
   183                         }
   183                         }
   184                     ),
   184                     ),
   185                 AnswerClients chans ["RUN_GAME"]
   185                 AnswerClients chans ["RUN_GAME"]
   186                 ]
   186                 ]
   187             else
   187             else
   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     let clTeams = map teamname . filter (\t -> teamowner t == nick cl) . teams $ rm
   213     let clTeams = map teamname . filter (\t -> teamowner t == nick cl) . teams $ rm
       
   214     let isLastPlayer = (teamsInGameNumber . fromJust . gameInfo $ rm) == length clTeams
   214 
   215 
   215     if isJust $ gameInfo rm then
   216     if isJust $ gameInfo rm then
   216         if isMaster cl && isCorrect then
   217         if (isMaster cl && isCorrect) || isLastPlayer then
   217             return $
   218             return $
   218                 SaveReplay
   219                 SaveReplay
   219                 : ModifyRoom
   220                 : ModifyRoom
   220                     (\r -> r{
   221                     (\r -> r{
   221                         gameInfo = Nothing,
   222                         gameInfo = Nothing,