gameServer/HWProtoInRoomState.hs
changeset 11561 af9aa8d5863c
parent 11513 a4ad8a9e0f69
child 11562 cf5d45444357
--- a/gameServer/HWProtoInRoomState.hs	Fri Feb 19 00:07:59 2016 +0100
+++ b/gameServer/HWProtoInRoomState.hs	Sat Feb 20 22:02:13 2016 +0300
@@ -54,7 +54,7 @@
                 , AnswerClients chans ["RUN_GAME"]
                 , SendUpdateOnThisRoom
                 , AnswerClients chans $ "CLIENT_FLAGS" : "+g" : nicks
-                , ModifyRoomClients (\c -> c{isInGame = True})
+                , ModifyRoomClients (\c -> c{isInGame = True, teamIndexes = map snd . filter (\(t, _) -> teamowner t == nick cl) $ zip (teams rm) [0..]})
                 ]
             else
             return [Warning $ loc "Less than two clans!"]
@@ -260,6 +260,8 @@
     rm <- thisRoom
     chans <- roomOthersChans
 
+    let (legalMsgs, nonEmptyMsgs, lastFTMsg) = checkNetCmd (teamIndexes cl) msg
+
     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then
         return $ AnswerClients chans ["EM", legalMsgs]
             : [ModifyRoom (\r -> r{gameInfo = liftM
@@ -269,8 +271,6 @@
                 $ gameInfo r}), RegisterEvent EngineMessage]
         else
         return []
-    where
-        (legalMsgs, nonEmptyMsgs, lastFTMsg) = checkNetCmd msg
 
 
 handleCmd_inRoom ["ROUNDFINISHED", _] = do