gameServer/HWProtoInRoomState.hs
branchwebgl
changeset 9521 8054d9d775fd
parent 9127 e350500c4edb
parent 9454 ac1874d56057
child 9950 2759212a27de
--- a/gameServer/HWProtoInRoomState.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/HWProtoInRoomState.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -217,11 +217,15 @@
 
     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then
         return $ AnswerClients chans ["EM", legalMsgs]
-            : [ModifyRoom (\r -> r{gameInfo = liftM (\g -> g{roundMsgs = nonEmptyMsgs : roundMsgs g}) $ gameInfo r}) | not $ B.null nonEmptyMsgs]
+            : [ModifyRoom (\r -> r{gameInfo = liftM 
+                (\g -> g{
+                    roundMsgs = if B.null nonEmptyMsgs then roundMsgs g else nonEmptyMsgs : roundMsgs g
+                    , lastFilteredTimedMsg = fromMaybe (lastFilteredTimedMsg g) lastFTMsg})
+                $ gameInfo r})]
         else
         return []
     where
-        (legalMsgs, nonEmptyMsgs) = checkNetCmd msg
+        (legalMsgs, nonEmptyMsgs, lastFTMsg) = checkNetCmd msg
 
 
 handleCmd_inRoom ["ROUNDFINISHED", _] = do
@@ -283,6 +287,9 @@
         if not $ isMaster cl then
             [ProtocolError $ loc "Not room master"]
         else
+        if illegalName newName then 
+            [Warning $ loc "Illegal room name"]
+        else
         if isJust $ find (\r -> newName == name r) rs then
             [Warning $ loc "Room with such name already exists"]
         else