- Revert server workaround over desync from r98e2dbdda8c0
authorunc0rr
Wed, 10 Apr 2013 22:48:14 +0400
changeset 8897 d6c310c65c91
parent 8895 95177c18e38c
child 8899 7493dde4ef51
- Revert server workaround over desync from r98e2dbdda8c0 - Don't allow more than 48 hedgehogs
gameServer/CoreTypes.hs
gameServer/HWProtoCore.hs
gameServer/HWProtoInRoomState.hs
gameServer/HWProtoLobbyState.hs
gameServer/NetRoutines.hs
--- a/gameServer/CoreTypes.hs	Wed Apr 10 07:44:51 2013 +0300
+++ b/gameServer/CoreTypes.hs	Wed Apr 10 22:48:14 2013 +0400
@@ -108,8 +108,7 @@
         isKickedFromServer :: Bool,
         clientClan :: !(Maybe B.ByteString),
         checkInfo :: Maybe CheckInfo,
-        teamsInGame :: Word,
-        actionsPending :: [Action]
+        teamsInGame :: Word
     }
 
 instance Eq ClientInfo where
--- a/gameServer/HWProtoCore.hs	Wed Apr 10 07:44:51 2013 +0300
+++ b/gameServer/HWProtoCore.hs	Wed Apr 10 22:48:14 2013 +0400
@@ -30,7 +30,7 @@
 handleCmd ["PONG"] = do
     cl <- thisClient
     if pingsQueue cl == 0 then
-        return $ actionsPending cl ++ [ModifyClient (\c -> c{actionsPending = []})]
+        return [ProtocolError "Protocol violation"]
         else
         return [ModifyClient (\c -> c{pingsQueue = pingsQueue c - 1})]
 
--- a/gameServer/HWProtoInRoomState.hs	Wed Apr 10 07:44:51 2013 +0300
+++ b/gameServer/HWProtoInRoomState.hs	Wed Apr 10 22:48:14 2013 +0400
@@ -59,7 +59,7 @@
                 else
                 liftM (head . (L.\\) (map B.singleton ['0'..]) . map teamcolor . teams) thisRoom
         let roomTeams = teams rm
-        let hhNum = let p = if not $ null roomTeams then hhnum $ head roomTeams else 4 in newTeamHHNum roomTeams p
+        let hhNum = let p = if not $ null roomTeams then minimum [hhnum $ head roomTeams, canAddNumber roomTeams] else 4 in newTeamHHNum roomTeams p
         let newTeam = clNick `seq` TeamInfo ci clNick tName teamColor grave fort voicepack flag dif hhNum (hhsList hhsInfo)
         return $
             if not . null . drop (maxTeams rm - 1) $ roomTeams then
@@ -79,9 +79,7 @@
                 AnswerClients clChan ["TEAM_ACCEPTED", tName],
                 AnswerClients othChans $ teamToNet $ newTeam,
                 AnswerClients roomChans ["TEAM_COLOR", tName, teamColor],
-                ModifyClient $ \c -> c{actionsPending = actionsPending cl
-                    ++ [AnswerClients clChan ["HH_NUM", tName, showB $ hhnum newTeam]]
-                    },
+                AnswerClients roomChans ["HH_NUM", tName, showB $ hhnum newTeam],
                 AnswerClients [sendChan cl] ["PING"]
                 ]
         where
--- a/gameServer/HWProtoLobbyState.hs	Wed Apr 10 07:44:51 2013 +0300
+++ b/gameServer/HWProtoLobbyState.hs	Wed Apr 10 22:48:14 2013 +0400
@@ -92,12 +92,9 @@
                 , AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick]
             ]
             ++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients])
-            ++ [AnswerClients [sendChan cl] ["PING"]
-                , ModifyClient $ \c -> c{actionsPending = actionsPending cl
-                    ++ answerFullConfig cl (mapParams jRoom) (params jRoom)
-                    ++ answerTeams cl jRoom
-                    ++ watchRound cl jRoom chans}
-                ]
+            ++ answerFullConfig cl (mapParams jRoom) (params jRoom)
+            ++ answerTeams cl jRoom
+            ++ watchRound cl jRoom chans
 
         where
         readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
--- a/gameServer/NetRoutines.hs	Wed Apr 10 07:44:51 2013 +0300
+++ b/gameServer/NetRoutines.hs	Wed Apr 10 22:48:14 2013 +0400
@@ -47,7 +47,6 @@
                     Nothing
                     Nothing
                     0
-                    []
                     )
 
         writeChan chan $ Accept newClient