Client flags handling implementation start qmlfrontend
authorunc0rr
Mon, 07 Dec 2015 00:05:41 +0300
branchqmlfrontend
changeset 11449 2bf0491d5e88
parent 11448 42a9dd7b724c
child 11450 0c75fa9ce340
Client flags handling implementation start
hedgewars/uFLNetProtocol.pas
hedgewars/uFLTypes.pas
--- a/hedgewars/uFLNetProtocol.pas	Sun Dec 06 20:36:21 2015 +0300
+++ b/hedgewars/uFLNetProtocol.pas	Mon Dec 07 00:05:41 2015 +0300
@@ -269,18 +269,46 @@
         sendUI(mtLobbyChatLine, @s[1], length(s));
 end;
 
+var flags: array[TClientFlag] of LongInt;
+    isFlagsLine: boolean;
 procedure handler_CLIENT_FLAGS(var p: TCmdParamS);
+var f: TClientFlag;
 begin
+    for f:= Low(TClientFlag) to High(TClientFlag) do
+        flags[f]:= 0;
+
+    isFlagsLine:= true;
 end;
 
 procedure handler_CLIENT_FLAGS_s(var s: TCmdParamS);
+var isRemoval: boolean;
+    flagValue, i: LongInt;
 begin
+    if isFlagsLine then
+    begin
+        if s.str[1] = '+' then flagValue:= 1 else flagValue:= -1;
+        for i:= 2 to Length(s.str1) do
+            case s.str[1] of
+                'r': flags[cfReady]:= flagValue;
+                'u': flags[cfRegistered]:= flagValue;
+                'i': flags[cfInRoom]:= flagValue;
+                'c': flags[cfContributor]:= flagValue;
+                'g': flags[cfInGame]:= flagValue;
+                'h': flags[cfRoomAdmin]:= flagValue;
+                'a': flags[cfServerAdmin]:= flagValue;
+            end;
+
+        isFlagsLine:= false;
+    end else
+    begin
+
+    end
 end;
 
 procedure handler_CONNECTED(var p: TCmdParami);
 begin
     sendUI(mtConnected, nil, 0);
-    writeln('Server features version ', p.param1);
+    //writeln('Server features version ', p.param1);
     sendNet('PROTO' + #10 + '51');
     sendNet('NICK' + #10 + 'qmlfrontend');
 end;
--- a/hedgewars/uFLTypes.pas	Sun Dec 06 20:36:21 2015 +0300
+++ b/hedgewars/uFLTypes.pas	Mon Dec 07 00:05:41 2015 +0300
@@ -16,6 +16,8 @@
 
     TFLIBEvent = (flibGameFinished);
 
+    TClientFlag = (cfReady, cfRegistered, cfInRoom, cfContributor, cfInGame, cfRoomAdmin, cfServerAdmin);
+
     TIPCMessage = record
                    str: shortstring;
                    len: Longword;