From 4dc7b33e17069c6559e9b1b7cc1ecd878162f629 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 17 Sep 2011 16:39:27 +0000 Subject: Add multiplayer query code to setup tool, and rework join game interface. Subversion-branch: /branches/v2-branch Subversion-revision: 2382 --- src/Makefile.am | 6 ++++++ src/net_common.c | 22 +--------------------- src/net_common.h | 1 - src/net_structrw.c | 21 +++++++++++++++++++++ src/net_structrw.h | 2 ++ src/setup/multiplayer.c | 13 +++++++------ 6 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 99ace5cc..1bf6e2c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -182,8 +182,14 @@ SETUP_FILES= \ 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 diff --git a/src/net_common.c b/src/net_common.c index 57699fd9..f25cc73d 100644 --- a/src/net_common.c +++ b/src/net_common.c @@ -22,7 +22,6 @@ // #include -#include #include #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 @@ -513,26 +513,6 @@ unsigned int NET_ExpandTicNum(unsigned int relative, unsigned int b) 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 boolean NET_ValidGameSettings(GameMode_t mode, GameMission_t mission, diff --git a/src/net_common.h b/src/net_common.h index 49a06024..96e9a648 100644 --- a/src/net_common.h +++ b/src/net_common.h @@ -110,7 +110,6 @@ net_packet_t *NET_Conn_NewReliable(net_connection_t *conn, int packet_type); // 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); diff --git a/src/net_structrw.c b/src/net_structrw.c index 7380e334..7ed61c24 100644 --- a/src/net_structrw.c +++ b/src/net_structrw.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "doomtype.h" @@ -406,3 +407,23 @@ void NET_WriteMD5Sum(net_packet_t *packet, md5_digest_t digest) } } +// "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'); +} + diff --git a/src/net_structrw.h b/src/net_structrw.h index 68971cd3..9f62176a 100644 --- a/src/net_structrw.h +++ b/src/net_structrw.h @@ -46,5 +46,7 @@ void NET_WriteFullTiccmd(net_packet_t *packet, net_full_ticcmd_t *cmd, boolean l 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 */ diff --git a/src/setup/multiplayer.c b/src/setup/multiplayer.c index aed89212..b625f056 100644 --- a/src/setup/multiplayer.c +++ b/src/setup/multiplayer.c @@ -797,7 +797,7 @@ void JoinMultiGame(void) 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 @@ void JoinMultiGame(void) } 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); -- cgit v1.2.3