gameServer/Actions.hs
changeset 6541 08ed346ed341
parent 6191 190a8e5d9956
child 6733 5abbc345a82f
--- a/gameServer/Actions.hs	Thu Dec 29 09:40:16 2011 +0100
+++ b/gameServer/Actions.hs	Thu Dec 29 23:02:40 2011 +0300
@@ -243,10 +243,16 @@
         AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"]
         ]
 
+    proto <- client's clientProto
+    newRoom <- io $ room'sM rnc id ri
+    chans <- liftM (map sendChan) $! sameProtoClientsS proto
+    processAction $ AnswerClients chans ("ROOM" : "ADD" : roomInfo (nick newMaster) newRoom)
+
 processAction (AddRoom roomName roomPassword) = do
     Just clId <- gets clientIndex
     rnc <- gets roomsClients
-    proto <- io $ client'sM rnc clientProto clId
+    proto <- client's clientProto
+    n <- client's nick
 
     let rm = newRoom{
             masterID = clId,
@@ -259,10 +265,10 @@
 
     processAction $ MoveToRoom rId
 
-    chans <- liftM (map sendChan) $! roomClientsS lobbyId
+    chans <- liftM (map sendChan) $! sameProtoClientsS proto
 
     mapM_ processAction [
-        AnswerClients chans ["ROOM", "ADD", roomName]
+        AnswerClients chans ("ROOM" : "ADD" : roomInfo n rm)
         , ModifyClient (\cl -> cl{isMaster = True})
         ]
 
@@ -273,10 +279,11 @@
     ri <- io $ clientRoomM rnc clId
     roomName <- io $ room'sM rnc name ri
     others <- othersChans
-    lobbyChans <- liftM (map sendChan) $! roomClientsS lobbyId
+    proto <- client's clientProto
+    chans <- liftM (map sendChan) $! sameProtoClientsS proto
 
     mapM_ processAction [
-            AnswerClients lobbyChans ["ROOM", "DEL", roomName],
+            AnswerClients chans ["ROOM", "DEL", roomName],
             AnswerClients others ["ROOMABANDONED", roomName]
         ]