merge
authorunc0rr
Sat, 07 Feb 2015 23:25:33 +0300
changeset 10816 37410518628e
parent 10813 ba1a607a0c9a (current diff)
parent 10815 2a85c551909c (diff)
child 10817 48a53259fad8
child 10818 f642a28cab0c
merge
--- a/gameServer/Actions.hs	Fri Feb 06 16:08:02 2015 +0300
+++ b/gameServer/Actions.hs	Sat Feb 07 23:25:33 2015 +0300
@@ -356,6 +356,9 @@
                         ) joinedMidGame
                      ) ri
 
+    rteams <- io $ room'sM rnc (L.nub . rejoinedTeams . fromJust . gameInfo) ri
+    mapM_ (processAction . RemoveTeam) rteams
+
     mapM_ processAction $ (
         SaveReplay
         : ModifyRoom
--- a/gameServer/CoreTypes.hs	Fri Feb 06 16:08:02 2015 +0300
+++ b/gameServer/CoreTypes.hs	Sat Feb 07 23:25:33 2015 +0300
@@ -186,6 +186,7 @@
         roundMsgs :: [B.ByteString],
         lastFilteredTimedMsg :: Maybe B.ByteString,
         leftTeams :: [B.ByteString],
+        rejoinedTeams :: [B.ByteString], -- for 0.9.21 frontend workaround
         teamsAtStart :: [TeamInfo],
         teamsInGameNumber :: Int,
         allPlayersHaveRegisteredAccounts :: !Bool,
@@ -206,6 +207,7 @@
         []
         Nothing
         []
+        []
 
 
 data RoomInfo =
--- a/gameServer/HWProtoLobbyState.hs	Fri Feb 06 16:08:02 2015 +0300
+++ b/gameServer/HWProtoLobbyState.hs	Sat Feb 07 23:25:33 2015 +0300
@@ -105,7 +105,7 @@
                 : AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl]
                 : [(AnswerClients [sendChan cl] $ "JOINED" : nicks) | not $ null nicks]
             )
-            -- ++ [ModifyRoom (\r -> let (t', g') = moveTeams clTeams . fromJust $ gameInfo r in r{gameInfo = Just g', teams = t'}) | not $ null clTeams]
+            ++ [ModifyRoom (\r -> let (t', g') = moveTeams clTeams . fromJust $ gameInfo r in r{gameInfo = Just g', teams = t'}) | not $ null clTeams]
             ++ [AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+h", nick $ fromJust owner] | isJust owner]
             ++ [sendStateFlags cl jRoomClients | not $ null jRoomClients]
             ++ answerFullConfig cl jRoom
@@ -117,7 +117,7 @@
         where
         moveTeams :: [B.ByteString] -> GameInfo -> ([TeamInfo], GameInfo)
         moveTeams cts g = (deleteFirstsBy2 (\a b -> teamname a == b) (teamsAtStart g) (leftTeams g \\ cts)
-            , g{leftTeams = leftTeams g \\ cts, teamsInGameNumber = teamsInGameNumber g + length cts})
+            , g{leftTeams = leftTeams g \\ cts, rejoinedTeams = rejoinedTeams g ++ cts, teamsInGameNumber = teamsInGameNumber g + length cts})
         sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $
                 [f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby]
             where
--- a/hedgewars/uGearsHandlersMess.pas	Fri Feb 06 16:08:02 2015 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Feb 07 23:25:33 2015 +0300
@@ -1799,7 +1799,7 @@
         ((TurnTimeLeft < cHedgehogTurnTime) and (cHedgehogTurnTime-TurnTimeLeft < 5000)) or
         (Gear^.State and gsttmpFlag = 0) or
         (Gear^.Angle = 0) then
-        gear^.State:= gear^.State and not gstHHChooseTarget
+        gear^.State:= gear^.State and (not gstHHChooseTarget)
     else if
     // todo, allow not finding new target, set timeout on target retention
         (Gear^.State and gstAttacking = 0) and