shithub: choc

Download patch

ref: 4dc7b33e17069c6559e9b1b7cc1ecd878162f629
parent: 1f170ff1ce5cf9b9b55b3a09c0840e237432477c
author: Simon Howard <fraggle@gmail.com>
date: Sat Sep 17 12:39:27 EDT 2011

Add multiplayer query code to setup tool, and rework join game
interface.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2382

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -182,8 +182,14 @@
 deh_str.c            deh_str.h             \
 d_mode.c             d_mode.h              \
 d_iwad.c             d_iwad.h              \
+i_timer.c            i_timer.h             \
 m_config.c           m_config.h            \
 m_controls.c         m_controls.h          \
+net_io.c             net_io.h              \
+net_packet.c         net_packet.h          \
+net_sdl.c            net_sdl.h             \
+net_query.c          net_query.h           \
+net_structrw.c       net_structrw.h        \
 z_native.c           z_zone.h
 
 if HAVE_WINDRES
--- a/src/net_common.c
+++ b/src/net_common.c
@@ -22,7 +22,6 @@
 //
 
 #include <stdio.h>
-#include <ctype.h>
 #include <stdlib.h>
 
 #include "doomtype.h"
@@ -32,6 +31,7 @@
 #include "net_common.h"
 #include "net_io.h"
 #include "net_packet.h"
+#include "net_structrw.h"
 
 // connections time out after 10 seconds
 
@@ -511,26 +511,6 @@
         result += 0x100;
     
     return result;
-}
-
-// "Safe" version of puts, for displaying messages received from the
-// network.
-
-void NET_SafePuts(char *s)
-{
-    char *p;
-
-    // Do not do a straight "puts" of the string, as this could be
-    // dangerous (sending control codes to terminals can do all
-    // kinds of things)
-
-    for (p=s; *p; ++p)
-    {
-        if (isprint(*p))
-            putchar(*p);
-    }
-
-    putchar('\n');
 }
 
 // Check that game settings are valid
--- a/src/net_common.h
+++ b/src/net_common.h
@@ -110,7 +110,6 @@
 
 // Other miscellaneous common functions
 
-void NET_SafePuts(char *msg);
 unsigned int NET_ExpandTicNum(unsigned int relative, unsigned int b);
 boolean NET_ValidGameSettings(GameMode_t mode, GameMission_t mission, 
                               net_gamesettings_t *settings);
--- a/src/net_structrw.c
+++ b/src/net_structrw.c
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 
 #include "doomtype.h"
 
@@ -404,5 +405,25 @@
     {
         NET_WriteInt8(packet, digest[i]);
     }
+}
+
+// "Safe" version of puts, for displaying messages received from the
+// network.
+
+void NET_SafePuts(char *s)
+{
+    char *p;
+
+    // Do not do a straight "puts" of the string, as this could be
+    // dangerous (sending control codes to terminals can do all
+    // kinds of things)
+
+    for (p=s; *p; ++p)
+    {
+        if (isprint(*p))
+            putchar(*p);
+    }
+
+    putchar('\n');
 }
 
--- a/src/net_structrw.h
+++ b/src/net_structrw.h
@@ -46,5 +46,7 @@
 boolean NET_ReadMD5Sum(net_packet_t *packet, md5_digest_t digest);
 void NET_WriteMD5Sum(net_packet_t *packet, md5_digest_t digest);
 
+void NET_SafePuts(char *msg);
+
 #endif /* #ifndef NET_STRUCTRW_H */
 
--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -797,7 +797,7 @@
     TXT_AddWidgets(window, 
         gameopt_table = TXT_NewTable(2),
         TXT_NewSeparator("Server"),
-        serveropt_table = TXT_NewTable(2),
+        serveropt_table = TXT_NewTable(1),
         TXT_NewStrut(0, 1),
         TXT_NewButton2("Add extra parameters...", OpenExtraParamsWindow, NULL),
         NULL);
@@ -819,11 +819,12 @@
     }
 
     TXT_AddWidgets(serveropt_table,
-                   TXT_NewRadioButton("Connect to address:",
-                                      &jointype, JOIN_ADDRESS),
-                   address_box = TXT_NewInputBox(&connect_address, 30),
-                   TXT_NewRadioButton("Auto-join LAN game",
-                                      &jointype, JOIN_AUTO_LAN),
+                   TXT_NewHorizBox(
+                           TXT_NewLabel("Connect to address: "),
+                           address_box = TXT_NewInputBox(&connect_address, 30),
+                           NULL),
+                   TXT_NewButton("Find server on Internet..."),
+                   TXT_NewButton("Find server on local network..."),
                    NULL);
 
     TXT_SignalConnect(address_box, "changed", SelectAddressJoin, NULL);