Send team removal message on incorrect engine shutdown (when game not finished). Should help with game hang when room master closes engine, then quits room.
authorunc0rr
Thu, 16 Feb 2012 20:32:47 +0400
changeset 6690 46b3f4776538
parent 6689 98a239848ba2
child 6691 79c96abd06d6
Send team removal message on incorrect engine shutdown (when game not finished). Should help with game hang when room master closes engine, then quits room.
gameServer/HWProtoInRoomState.hs
--- a/gameServer/HWProtoInRoomState.hs	Thu Feb 16 16:16:59 2012 +0100
+++ b/gameServer/HWProtoInRoomState.hs	Thu Feb 16 20:32:47 2012 +0400
@@ -206,11 +206,12 @@
 
 
 handleCmd_inRoom ["ROUNDFINISHED", correctly] = do
+    clId <- asks fst
     cl <- thisClient
     rm <- thisRoom
     chans <- roomClientsChans
 
-    if isMaster cl && (isJust $ gameInfo rm) then
+    if isMaster cl && isCorrect && (isJust $ gameInfo rm) then
         return $
             SaveReplay
             : ModifyRoom
@@ -222,7 +223,7 @@
             : UnreadyRoomClients
             : answerRemovedTeams chans rm
         else
-        return []
+        return [RemoveClientTeams clId]
     where
         answerRemovedTeams chans = map (\t -> AnswerClients chans ["REMOVE_TEAM", t]) . leftTeams . fromJust . gameInfo
         isCorrect = correctly == "1"