gameServer/Actions.hs
changeset 7668 4cb423f42105
parent 7664 4bc4b739f6e0
child 7682 f6bfbe829008
equal deleted inserted replaced
7667:4346566c5a58 7668:4cb423f42105
   242     ri <- clientRoomA
   242     ri <- clientRoomA
   243     rnc <- gets roomsClients
   243     rnc <- gets roomsClients
   244     newMasterId <- liftM (head . filter (/= ci)) . io $ roomClientsIndicesM rnc ri
   244     newMasterId <- liftM (head . filter (/= ci)) . io $ roomClientsIndicesM rnc ri
   245     newMaster <- io $ client'sM rnc id newMasterId
   245     newMaster <- io $ client'sM rnc id newMasterId
   246     oldRoomName <- io $ room'sM rnc name ri
   246     oldRoomName <- io $ room'sM rnc name ri
       
   247     thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
   247     let newRoomName = nick newMaster
   248     let newRoomName = nick newMaster
   248     mapM_ processAction [
   249     mapM_ processAction [
   249         ModifyRoom (\r -> r{masterID = newMasterId, name = newRoomName, isRestrictedJoins = False, isRestrictedTeams = False}),
   250         ModifyRoom (\r -> r{masterID = newMasterId, name = newRoomName, isRestrictedJoins = False, isRestrictedTeams = False}),
   250         ModifyClient2 newMasterId (\c -> c{isMaster = True}),
   251         ModifyClient2 newMasterId (\c -> c{isMaster = True}),
   251         AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"]
   252         AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"],
       
   253         AnswerClients thisRoomChans ["WARNING", "New room admin is " `B.append` nick newMaster]
   252         ]
   254         ]
   253 
   255 
   254     proto <- client's clientProto
   256     proto <- client's clientProto
   255     newRoom <- io $ room'sM rnc id ri
   257     newRoom <- io $ room'sM rnc id ri
   256     chans <- liftM (map sendChan) $! sameProtoClientsS proto
   258     chans <- liftM (map sendChan) $! sameProtoClientsS proto