gameServer/Actions.hs
changeset 7926 550083f61a0e
parent 7924 351f970c60e1
child 7945 4006d77e1a28
equal deleted inserted replaced
7924:351f970c60e1 7926:550083f61a0e
   253 processAction ChangeMaster = do
   253 processAction ChangeMaster = do
   254     (Just ci) <- gets clientIndex
   254     (Just ci) <- gets clientIndex
   255     proto <- client's clientProto
   255     proto <- client's clientProto
   256     ri <- clientRoomA
   256     ri <- clientRoomA
   257     rnc <- gets roomsClients
   257     rnc <- gets roomsClients
   258     newMasterId <- liftM (head . filter (/= ci)) . io $ roomClientsIndicesM rnc ri
   258     newMasterId <- liftM (last . filter (/= ci)) . io $ roomClientsIndicesM rnc ri
   259     newMaster <- io $ client'sM rnc id newMasterId
   259     newMaster <- io $ client'sM rnc id newMasterId
   260     oldRoomName <- io $ room'sM rnc name ri
   260     oldRoomName <- io $ room'sM rnc name ri
   261     oldMaster <- client's nick
   261     oldMaster <- client's nick
   262     thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
   262     thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
   263     let newRoomName = if proto < 42 then nick newMaster else oldRoomName
   263     let newRoomName = if proto < 42 then nick newMaster else oldRoomName
   324     Just clId <- gets clientIndex
   324     Just clId <- gets clientIndex
   325     proto <- client's clientProto
   325     proto <- client's clientProto
   326     rnc <- gets roomsClients
   326     rnc <- gets roomsClients
   327     ri <- io $ clientRoomM rnc clId
   327     ri <- io $ clientRoomM rnc clId
   328     rm <- io $ room'sM rnc id ri
   328     rm <- io $ room'sM rnc id ri
       
   329     n <- io $ client'sM rnc nick (masterID rm)
   329     chans <- liftM (map sendChan) $! sameProtoClientsS proto
   330     chans <- liftM (map sendChan) $! sameProtoClientsS proto
   330     n <- client's nick
       
   331     processAction $ AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo n rm)
   331     processAction $ AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo n rm)
   332 
   332 
   333 
   333 
   334 processAction UnreadyRoomClients = do
   334 processAction UnreadyRoomClients = do
   335     ri <- clientRoomA
   335     ri <- clientRoomA