Send room config to client server_refactor
authorunc0rr
Tue, 25 Jan 2011 22:23:08 +0300
branchserver_refactor
changeset 4587 adf64662b6a8
parent 4585 6e747aef012f
child 4591 c91364bf6a69
Send room config to client
gameServer/Actions.hs
gameServer/HWProtoLobbyState.hs
--- a/gameServer/Actions.hs	Tue Jan 25 22:13:34 2011 +0300
+++ b/gameServer/Actions.hs	Tue Jan 25 22:23:08 2011 +0300
@@ -188,6 +188,7 @@
 
     processAction $ AnswerClients chans ["JOINED", clNick]
 
+
 processAction (MoveToLobby msg) = do
     (Just ci) <- gets clientIndex
     ri <- clientRoomA
--- a/gameServer/HWProtoLobbyState.hs	Tue Jan 25 22:13:34 2011 +0300
+++ b/gameServer/HWProtoLobbyState.hs	Tue Jan 25 22:23:08 2011 +0300
@@ -90,10 +90,17 @@
                 AnswerClients [sendChan cl] $ "JOINED" : map nick jRoomClients
             ]
             ++ (map (readynessMessage cl) jRoomClients)
+            ++ (answerFullConfig cl $ params jRoom)
 
-    where
+        where
         readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
 
+        toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
+
+        answerFullConfig cl params = map (toAnswer cl) (leftConfigPart ++ rightConfigPart)
+            where
+            (leftConfigPart, rightConfigPart) = partition (\(p, _) -> p /= "MAP") $ Map.toList params
+
 
 
 {-