Fix two bugs, and yay, spectating works now qmlfrontend
authorunc0rr
Sun, 20 Dec 2015 12:45:49 +0300
branchqmlfrontend
changeset 11460 9f2fb0031ef0
parent 11459 30397f91571c
child 11462 33a0e3a14ddc
Fix two bugs, and yay, spectating works now
hedgewars/uFLIPC.pas
hedgewars/uFLNetProtocol.pas
hedgewars/uFLRunQueue.pas
hedgewars/uFLTypes.pas
--- a/hedgewars/uFLIPC.pas	Thu Dec 17 00:51:20 2015 +0300
+++ b/hedgewars/uFLIPC.pas	Sun Dec 20 12:45:49 2015 +0300
@@ -51,6 +51,7 @@
         queue^.last^.next:= pmsg;
         queue^.last:= pmsg;
     end;
+
     SDL_CondSignal(queue^.cond);
     SDL_UnlockMutex(queue^.mut);
 end;
@@ -129,10 +130,8 @@
     SDL_LockMutex(q^.mut);
 
     pmsg:= @q^.msg;
-write('    ipcRemoveBarrierFromEngineQueue: ');
     while pmsg <> nil do
     begin
-        write('.');
         t:= pmsg^.next;
         q^.msg.next:= t;
 
@@ -166,7 +165,7 @@
 
         pmsg:= t
     end;
-writeln;
+
     if q^.msg.next = nil then q^.last:= @q^.msg;
 
     q^.msg.str[0]:= #0;
@@ -290,6 +289,7 @@
     new(q);
     q^.msg.str:= '';
     q^.msg.buf:= nil;
+    q^.msg.barrier:= 0;
     q^.mut:= SDL_CreateMutex;
     q^.cond:= SDL_CreateCond;
     q^.msg.next:= nil;
--- a/hedgewars/uFLNetProtocol.pas	Thu Dec 17 00:51:20 2015 +0300
+++ b/hedgewars/uFLNetProtocol.pas	Sun Dec 20 12:45:49 2015 +0300
@@ -327,7 +327,7 @@
     while i < l do
     begin
         s:= DecodeBase64(copy(p.str1, i, 240));
-        ipcToEngineRaw(@s[0], byte(s[0]));
+        ipcToEngineRaw(@s[1], byte(s[0]));
         inc(i, 160)
     end;
 end;
@@ -495,10 +495,8 @@
 end;
 
 procedure handler_RUN_GAME(var p: TCmdParam);
-var e: TFLIBEvent;
 begin
-    e:= flibRunNetGame;
-    sendUI(mtFlibEvent, @e, sizeof(e));
+    runNetGame
 end;
 
 procedure handler_SERVER_AUTH(var p: TCmdParamS);
--- a/hedgewars/uFLRunQueue.pas	Thu Dec 17 00:51:20 2015 +0300
+++ b/hedgewars/uFLRunQueue.pas	Sun Dec 20 12:45:49 2015 +0300
@@ -14,7 +14,6 @@
 begin
     if runQueue <> nil then
     begin
-    writeln('RUNNING ', runQueue^.gameType);
         if runQueue^.gameType = gtPreview then
             sendUI(mtRenderingPreview, nil, 0);
 
@@ -35,7 +34,6 @@
 var pConfig, t, tt: PGameConfig;
     i: Longword;
 begin
-    writeln('QUEUE EXECUTION ', config.gameType);
     new(pConfig);
     pConfig^:= config;
 
@@ -86,12 +84,9 @@
 begin
     case TFLIBEvent(p^) of
         flibGameFinished: begin
-                cleanupConfig;
-                nextRun
-            end;
-        flibRunNetGame: begin
-                runNetGame
-            end;
+            cleanupConfig;
+            nextRun
+        end;
     end;
 end;
 
--- a/hedgewars/uFLTypes.pas	Thu Dec 17 00:51:20 2015 +0300
+++ b/hedgewars/uFLTypes.pas	Sun Dec 20 12:45:49 2015 +0300
@@ -15,7 +15,7 @@
                     , mtNickname, mtSeed, mtTheme, mtScript, mtFeatureSize, mtMapGen
                     , mtMap, mtMazeSize, mtTemplate, mtAmmo, mtScheme);
 
-    TFLIBEvent = (flibGameFinished, flibRunNetGame);
+    TFLIBEvent = (flibGameFinished);
 
     TClientFlag = (cfReady, cfRegistered, cfInRoom, cfContributor, cfInGame, cfRoomAdmin, cfServerAdmin);