Remove client's teams only when game is running and exit status is 'incorrect exit'. Frontend still sends excessive ROUND_FINISHED, so the bug is not fixed completely.
authorunc0rr
Sat, 25 Feb 2012 22:18:08 +0400
changeset 6738 dd98869d74b4
parent 6737 ce5fbd98370f
child 6739 97dab041f995
Remove client's teams only when game is running and exit status is 'incorrect exit'. Frontend still sends excessive ROUND_FINISHED, so the bug is not fixed completely.
gameServer/HWProtoInRoomState.hs
--- a/gameServer/HWProtoInRoomState.hs	Fri Feb 24 23:49:31 2012 +0400
+++ b/gameServer/HWProtoInRoomState.hs	Sat Feb 25 22:18:08 2012 +0400
@@ -211,19 +211,24 @@
     rm <- thisRoom
     chans <- roomClientsChans
 
-    if isMaster cl && isCorrect && (isJust $ gameInfo rm) then
-        return $
-            SaveReplay
-            : ModifyRoom
-                (\r -> r{
-                    gameInfo = Nothing,
-                    readyPlayers = 0
-                    }
-                )
-            : UnreadyRoomClients
-            : answerRemovedTeams chans rm
+    if isJust $ gameInfo rm then
+        if isMaster cl && isCorrect then
+            return $
+                SaveReplay
+                : ModifyRoom
+                    (\r -> r{
+                        gameInfo = Nothing,
+                        readyPlayers = 0
+                        }
+                    )
+                : UnreadyRoomClients
+                : answerRemovedTeams chans rm
+            else if not isCorrect then
+                return [RemoveClientTeams clId]
+                else
+                return []
         else
-        return [RemoveClientTeams clId]
+        return []
     where
         answerRemovedTeams chans = map (\t -> AnswerClients chans ["REMOVE_TEAM", t]) . leftTeams . fromJust . gameInfo
         isCorrect = correctly == "1"