gameServer/Votes.hs
changeset 11575 db7743e2fad1
parent 11046 47a8c19ecb60
child 13079 81c154fd4380
equal deleted inserted replaced
11573:8fd1808b12ed 11575:db7743e2fad1
    93     act (VoteMap roomSave) = do
    93     act (VoteMap roomSave) = do
    94         rm <- thisRoom
    94         rm <- thisRoom
    95         let rs = Map.lookup roomSave (roomSaves rm)
    95         let rs = Map.lookup roomSave (roomSaves rm)
    96         case rs of
    96         case rs of
    97              Nothing -> return []
    97              Nothing -> return []
    98              Just (mp, p) -> do
    98              Just (location, mp, p) -> do
    99                  cl <- thisClient
    99                  cl <- thisClient
   100                  chans <- roomClientsChans
   100                  chans <- roomClientsChans
   101                  let a = map (replaceChans chans) $ answerFullConfigParams cl mp p
   101                  return $
   102                  return $ 
   102                     [ModifyRoom $ \r -> r{params = p, mapParams = mp}
   103                     (ModifyRoom $ \r -> r{params = p, mapParams = mp})
   103                     , AnswerClients chans ["CHAT", "[server]", location]
   104                     : SendUpdateOnThisRoom
   104                     , SendUpdateOnThisRoom
   105                     : a
   105                     , LoadGhost location]
   106         where
       
   107             replaceChans chans (AnswerClients _ msg) = AnswerClients chans msg
       
   108             replaceChans _ a = a
       
   109     act (VotePause) = do
   106     act (VotePause) = do
   110         rm <- thisRoom
   107         rm <- thisRoom
   111         chans <- roomClientsChans
   108         chans <- roomClientsChans
   112         let modifyGameInfo f room  = room{gameInfo = fmap f $ gameInfo room}
   109         let modifyGameInfo f room  = room{gameInfo = fmap f $ gameInfo room}
   113         return [ModifyRoom (modifyGameInfo $ \g -> g{isPaused = not $ isPaused g}),
   110         return [ModifyRoom (modifyGameInfo $ \g -> g{isPaused = not $ isPaused g}),