gameServer/HWProtoInRoomState.hs
changeset 3543 d84a93b985c1
parent 3540 b602a57ba0fb
child 3544 aad64e15ca03
equal deleted inserted replaced
3542:f216b24aeb7f 3543:d84a93b985c1
   106         noSuchTeam = isNothing findTeam
   106         noSuchTeam = isNothing findTeam
   107         team = fromJust findTeam
   107         team = fromJust findTeam
   108         findTeam = find (\t -> teamName == teamname t) $ teams room
   108         findTeam = find (\t -> teamName == teamname t) $ teams room
   109         client = clients IntMap.! clID
   109         client = clients IntMap.! clID
   110         room = rooms IntMap.! (roomID client)
   110         room = rooms IntMap.! (roomID client)
   111 
   111 -}
   112 
   112 
   113 handleCmd_inRoom clID clients rooms ["TOGGLE_READY"] =
   113 handleCmd_inRoom ["TOGGLE_READY"] = do
   114     [ModifyClient (\c -> c{isReady = not $ isReady client}),
   114     cl <- thisClient
   115     ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady client then -1 else 1)}),
   115     chans <- roomClientsChans
   116     AnswerThisRoom [if isReady client then "NOT_READY" else "READY", nick client]]
   116     return [
   117     where
   117         ModifyClient (\c -> c{isReady = not $ isReady cl}),
   118         client = clients IntMap.! clID
   118         ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady cl then -1 else 1)}),
   119 
   119         AnswerClients chans [if isReady cl then "NOT_READY" else "READY", nick cl]
   120 
   120         ]
       
   121 
       
   122 {-
   121 handleCmd_inRoom clID clients rooms ["START_GAME"] =
   123 handleCmd_inRoom clID clients rooms ["START_GAME"] =
   122     if isMaster client && (playersIn room == readyPlayers room) && (not . gameinprogress) room then
   124     if isMaster client && (playersIn room == readyPlayers room) && (not . gameinprogress) room then
   123         if enoughClans then
   125         if enoughClans then
   124             [ModifyRoom
   126             [ModifyRoom
   125                     (\r -> r{
   127                     (\r -> r{