Small fixes qmlfrontend
authorunc0rr
Sat, 21 Nov 2015 09:56:00 +0300
branchqmlfrontend
changeset 11425 ef7f8ac96dfa
parent 11424 8a5cc31483c6
child 11426 25e0f427f57e
Small fixes
hedgewars/uFLNet.pas
hedgewars/uFLNetProtocol.pas
--- a/hedgewars/uFLNet.pas	Sat Nov 21 00:42:11 2015 +0300
+++ b/hedgewars/uFLNet.pas	Sat Nov 21 09:56:00 2015 +0300
@@ -53,7 +53,7 @@
     0, 0, 0, 0, 0, -32, 5, 0, 0, 0, -31, 11, 0, 0, 0, 3, 0, -30, 0, 0, 0, -29, 7, 0,
     0, 0, 0, 0, -28, 22, 4, 0, 0, -27, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, -26, 0, 0,
     0, 0, -25, 11, 4, 0, 0, -24, 0, 0, 0, 0, 0, -23, 10, 4, 0, 0, -22, 0, 0, 0, 0,
-    -21, 28, 19, 5, 3, 1, -20, -19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -18, 0, 0, 0,
+    -21, 28, 19, 5, 3, 1, -19, -20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -18, 0, 0, 0,
     0, 0, 0, 0, -17, 25, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, -16, 8, 0, 0, 0, 0, 0, 0,
     -15, 0, 0, 0, 0, -14, 20, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, -13, 0, 0, 0, 0,
     0, -12, 8, 0, 0, 0, 0, 0, 0, -11, 0, -10);
@@ -103,7 +103,9 @@
 begin
     cmd.cmd:= state.cmd;
     cmd.str1:= getShortString;
+    if cmd.str1[0] = #0 then exit;
     cmd.str2:= getShortString; // FIXME should be long string
+    if cmd.str2[0] = #0 then exit;
     sendUI(mtNetData, @cmd, sizeof(cmd));
     handleTail()
 end;
@@ -116,11 +118,15 @@
 
 procedure handler__i;
 var cmd: TCmdParami;
+    s: shortstring;
 begin
     writeln('handler__i');
-    getShortString;
+    s:= getShortString();
+    if s[0] = #0 then exit;
     cmd.cmd:= state.cmd;
-    cmd.param1:= strToInt(getShortString);
+    s:= getShortString();
+    if s[0] = #0 then exit;
+    cmd.param1:= strToInt(s);
     sendUI(mtNetData, @cmd, sizeof(cmd));
     handleTail()
 end;
@@ -158,8 +164,6 @@
 var cnt: Longint;
     c: char;
 begin
-    state.l:= 0;
-
     c:= getCurrChar;
     repeat
         if c = #10 then cnt:= 0 else cnt:= 1;
@@ -226,6 +230,7 @@
                     state.cmd:= net2cmd[-10 - commands[state.l]];
                     writeln('[NET] ', state.cmd);
                     handlers[-10 - commands[state.l]]();
+                    state.l:= 0
                 end
                 else
                     inc(state.l)
--- a/hedgewars/uFLNetProtocol.pas	Sat Nov 21 00:42:11 2015 +0300
+++ b/hedgewars/uFLNetProtocol.pas	Sat Nov 21 09:56:00 2015 +0300
@@ -190,7 +190,7 @@
 
     if roomLinesCount = 8 then
     begin
-        sendUI(mtAddRoom, @roomInfo[1], length(roomInfo));
+        sendUI(mtAddRoom, @roomInfo[1], length(roomInfo) - 1);
         roomLinesCount:= 0;
         roomInfo:= ''
     end else inc(roomLinesCount);