gameServer/HWProtoInRoomState.hs
changeset 8403 fbc6e7602e05
parent 8401 87410ae372f6
child 8416 e691acd778f5
equal deleted inserted replaced
8402:659e043da6da 8403:fbc6e7602e05
   302 
   302 
   303 handleCmd_inRoom ["DELEGATE", newAdmin] = do
   303 handleCmd_inRoom ["DELEGATE", newAdmin] = do
   304     (thisClientId, rnc) <- ask
   304     (thisClientId, rnc) <- ask
   305     maybeClientId <- clientByNick newAdmin
   305     maybeClientId <- clientByNick newAdmin
   306     master <- liftM isMaster thisClient
   306     master <- liftM isMaster thisClient
       
   307     serverAdmin <- liftM isAdministrator thisClient
   307     let newAdminId = fromJust maybeClientId
   308     let newAdminId = fromJust maybeClientId
   308     let sameRoom = clientRoom rnc thisClientId == clientRoom rnc newAdminId
   309     let sameRoom = clientRoom rnc thisClientId == clientRoom rnc newAdminId
   309     return
   310     return
   310         [ChangeMaster (Just newAdminId) | master && isJust maybeClientId && (newAdminId /= thisClientId) && sameRoom]
   311         [ChangeMaster (Just newAdminId) |
       
   312             (master || serverAdmin)
       
   313                 && isJust maybeClientId
       
   314                 && ((newAdminId /= thisClientId) || (serverAdmin && not master))
       
   315                 && sameRoom]
   311 
   316 
   312 
   317 
   313 handleCmd_inRoom ["TEAMCHAT", msg] = do
   318 handleCmd_inRoom ["TEAMCHAT", msg] = do
   314     cl <- thisClient
   319     cl <- thisClient
   315     chans <- roomSameClanChans
   320     chans <- roomSameClanChans