gameServer/Actions.hs
changeset 9062 a65492ca1587
parent 9060 1661c5ccb625
child 9109 878f06e9c484
child 9127 e350500c4edb
--- a/gameServer/Actions.hs	Mon May 27 23:24:35 2013 +0400
+++ b/gameServer/Actions.hs	Mon May 27 23:54:52 2013 +0400
@@ -207,8 +207,9 @@
     rnc <- gets roomsClients
     newMasterId <- liftM (\ids -> fromMaybe (last . filter (/= ci) $ ids) delegateId) . io $ roomClientsIndicesM rnc ri
     newMaster <- io $ client'sM rnc id newMasterId
+    oldMasterId <- io $ room'sM rnc masterID ri
+    oldMaster <- io $ client'sM rnc id oldMasterId
     oldRoomName <- io $ room'sM rnc name ri
-    oldMaster <- client's nick
     kicked <- client's isKickedFromServer
     thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
     let newRoomName = if (proto < 42) || kicked then nick newMaster else oldRoomName
@@ -220,9 +221,9 @@
                 , isRegisteredOnly = False}
                 )
         , ModifyClient2 newMasterId (\c -> c{isMaster = True})
-        , ModifyClient (\c -> c{isMaster = False})
+        , ModifyClient2 oldMasterId (\c -> c{isMaster = False})
         , AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"]
-        , AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", oldMaster]
+        , AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", nick oldMaster]
         , AnswerClients thisRoomChans ["CLIENT_FLAGS", "+h", nick newMaster]
         ]