Send spectators info server_refactor
authorunc0rr
Wed, 26 Jan 2011 22:26:02 +0300
branchserver_refactor
changeset 4595 cd4433b44920
parent 4593 39d07170085b
child 4597 31e042ab870c
Send spectators info
gameServer/HWProtoLobbyState.hs
--- a/gameServer/HWProtoLobbyState.hs	Wed Jan 26 22:06:27 2011 +0300
+++ b/gameServer/HWProtoLobbyState.hs	Wed Jan 26 22:26:02 2011 +0300
@@ -93,6 +93,7 @@
             ++ (map (readynessMessage cl) jRoomClients)
             ++ (answerFullConfig cl $ params jRoom)
             ++ (answerTeams cl jRoom)
+            ++ (watchRound cl jRoom)
 
         where
         readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
@@ -105,6 +106,12 @@
 
         answerTeams cl jRoom = let f = if gameinprogress jRoom then teamsAtStart else teams in answerAllTeams cl $ f jRoom
 
+        watchRound cl jRoom = if not $ gameinprogress jRoom then
+                    []
+                else
+                    [AnswerClients [sendChan cl]  ["RUN_GAME"],
+                    AnswerClients [sendChan cl] $ "EM" : toEngineMsg "e$spectate 1" : Foldable.toList (roundMsgs jRoom)]
+
 
 
 {-