DEADSOFTWARE

fixed exit from network related screens
[d2df-sdl.git] / src / game / g_net.pas
index 2c88e6dacf6962d0505bd19f8e4484d55c0e4f74..7e0f44d6eea0db1206c622dd7df555c4711a5ffe 100644 (file)
@@ -22,7 +22,7 @@ uses
   e_log, e_msg, ENet, Classes, MAPDEF{$IFDEF USE_MINIUPNPC}, miniupnpc;{$ELSE};{$ENDIF}
 
 const
-  NET_PROTOCOL_VER = 174;
+  NET_PROTOCOL_VER = 179;
 
   NET_MAXCLIENTS = 24;
   NET_CHANS = 11;
@@ -66,6 +66,12 @@ const
   BANLIST_FILENAME = 'banlist.txt';
   NETDUMP_FILENAME = 'netdump';
 
+  {$IFDEF FREEBSD}
+    NilThreadId = nil;
+  {$ELSE}
+    NilThreadId = 0;
+  {$ENDIF}
+
 type
   TNetClient = record
     ID:      Byte;
@@ -149,7 +155,7 @@ var
   NetIGDService: TURLStr;
 {$ENDIF}
 
-  NetPortThread: TThreadID = 0;
+  NetPortThread: TThreadID = NilThreadId;
 
   NetDumpFile: TStream;
 
@@ -319,10 +325,10 @@ begin
 
   NetMode := NET_NONE;
 
-  if NetPortThread <> 0 then
+  if NetPortThread <> NilThreadId then
     WaitForThreadTerminate(NetPortThread, 66666);
 
-  NetPortThread := 0;
+  NetPortThread := NilThreadId;
   g_Net_UnforwardPorts();
 
   if NetDump then
@@ -816,7 +822,8 @@ begin
 
     ProcessLoading(true);
 
-    if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
+    if e_KeyPressed(IK_SPACE) or e_KeyPressed(IK_ESCAPE) or e_KeyPressed(VK_ESCAPE) or
+       e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
       OuterLoop := False;
   end;
 
@@ -979,7 +986,8 @@ begin
 
     ProcessLoading(true);
 
-    if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
+    if e_KeyPressed(IK_SPACE) or e_KeyPressed(IK_ESCAPE) or e_KeyPressed(VK_ESCAPE) or
+       e_KeyPressed(JOY0_JUMP) or e_KeyPressed(JOY1_JUMP) or e_KeyPressed(JOY2_JUMP) or e_KeyPressed(JOY3_JUMP) then
       break;
   end;
   Result := msgStream;