Server-side workaround for frontend's script parameter bug in .21
authorunc0rr
Tue, 30 Dec 2014 22:12:07 +0300
changeset 10730 eac6a4d53752
parent 10728 d58d7d8b5392
child 10732 7c4f9e5e447c
Server-side workaround for frontend's script parameter bug in .21
gameServer/HWProtoInRoomState.hs
--- a/gameServer/HWProtoInRoomState.hs	Tue Dec 30 21:00:03 2014 +0300
+++ b/gameServer/HWProtoInRoomState.hs	Tue Dec 30 22:12:07 2014 +0300
@@ -87,15 +87,19 @@
             return [Warning $ loc "Restricted"]
         else if isMaster cl then
            return [
-                ModifyRoom f,
+                ModifyRoom $ f (clientProto cl),
                 AnswerClients chans ("CFG" : paramName : paramStrs)]
             else
             return [ProtocolError $ loc "Not room master"]
     where
-        f r = if paramName `Map.member` (mapParams r) then
+        f clproto r = if paramName `Map.member` (mapParams r) then
                 r{mapParams = Map.insert paramName (head paramStrs) (mapParams r)}
                 else
-                r{params = Map.insert paramName paramStrs (params r)}
+                r{params = Map.insert paramName (fixedParamStr clproto) (params r)}
+        fixedParamStr clproto
+            | clproto /= 49 = paramStrs
+            | paramName /= "SCHEME" = paramStrs
+            | otherwise = L.init paramStrs ++ [B.replicate 50 'X' `B.append` L.last paramStrs]
 
 
 handleCmd_inRoom ("ADD_TEAM" : tName : color : grave : fort : voicepack : flag : difStr : hhsInfo)