Send +i status of all players to logged-in users
authorunc0rr
Sun, 13 Oct 2013 21:53:42 +0400
changeset 9528 9351e96990ae
parent 9526 2fd51591b260
child 9530 0dc3b8f94b0b
child 9531 7fcdedc45589
Send +i status of all players to logged-in users
gameServer/Actions.hs
gameServer/CoreTypes.hs
gameServer/NetRoutines.hs
--- a/gameServer/Actions.hs	Sun Oct 13 13:14:32 2013 -0400
+++ b/gameServer/Actions.hs	Sun Oct 13 21:53:42 2013 +0400
@@ -456,6 +456,7 @@
 
 processAction JoinLobby = do
     chan <- client's sendChan
+    rnc <- gets roomsClients
     clientNick <- client's nick
     isAuthenticated <- liftM (not . B.null) $ client's webPassword
     isAdmin <- client's isAdministrator
@@ -465,6 +466,10 @@
     let authenticatedNicks = L.map nick . L.filter (not . B.null . webPassword) $ loggedInClients
     let adminsNicks = L.map nick . L.filter isAdministrator $ loggedInClients
     let contrNicks = L.map nick . L.filter isContributor $ loggedInClients
+    inRoomNicks <- io $
+        allClientsM rnc
+        >>= filterM (liftM ((/=) lobbyId) . clientRoomM rnc)
+        >>= mapM (client'sM rnc nick)
     let clFlags = B.concat . L.concat $ [["u" | isAuthenticated], ["a" | isAdmin], ["c" | isContr]]
     mapM_ processAction . concat $ [
         [AnswerClients clientsChans ["LOBBY:JOINED", clientNick]]
@@ -472,6 +477,7 @@
         , [AnswerClients [chan] ("CLIENT_FLAGS" : "+u" : authenticatedNicks) | not $ null authenticatedNicks]
         , [AnswerClients [chan] ("CLIENT_FLAGS" : "+a" : adminsNicks) | not $ null adminsNicks]
         , [AnswerClients [chan] ("CLIENT_FLAGS" : "+c" : contrNicks) | not $ null contrNicks]
+        , [AnswerClients [chan] ("CLIENT_FLAGS" : "+i" : inRoomNicks) | not $ null inRoomNicks]
         , [AnswerClients (chan : clientsChans) ["CLIENT_FLAGS",  B.concat["+" , clFlags], clientNick] | not $ B.null clFlags]
         , [ModifyClient (\cl -> cl{logonPassed = True, isVisible = True})]
         , [SendServerMessage]
--- a/gameServer/CoreTypes.hs	Sun Oct 13 13:14:32 2013 -0400
+++ b/gameServer/CoreTypes.hs	Sun Oct 13 21:53:42 2013 +0400
@@ -101,7 +101,6 @@
         logonPassed :: Bool,
         isVisible :: Bool,
         clientProto :: !Word16,
-        roomID :: RoomIndex,
         pingsQueue :: !Word,
         isMaster :: Bool,
         isReady :: !Bool,
--- a/gameServer/NetRoutines.hs	Sun Oct 13 13:14:32 2013 -0400
+++ b/gameServer/NetRoutines.hs	Sun Oct 13 21:53:42 2013 +0400
@@ -36,7 +36,6 @@
                     False
                     False
                     0
-                    lobbyId
                     0
                     False
                     False