From eb937f4d148a75c4f2b6d3f7687dae4ef2053105 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 9 Apr 2006 02:50:34 +0000 Subject: Broadcast searches (currently broken) Subversion-branch: /trunk/chocolate-doom Subversion-revision: 467 --- src/net_sdl.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/net_sdl.c') diff --git a/src/net_sdl.c b/src/net_sdl.c index 24be9627..25e79677 100644 --- a/src/net_sdl.c +++ b/src/net_sdl.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: net_sdl.c 465 2006-04-06 20:49:16Z fraggle $ +// $Id: net_sdl.c 467 2006-04-09 02:50:34Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -43,6 +43,7 @@ #include "i_system.h" #include "m_argv.h" #include "net_defs.h" +#include "net_io.h" #include "net_packet.h" #include "net_sdl.h" #include "z_zone.h" @@ -53,7 +54,9 @@ #include -static int port = 2342; +#define DEFAULT_PORT 2342 + +static int port = DEFAULT_PORT; static UDPsocket udpsocket; static UDPpacket *recvpacket; @@ -208,7 +211,17 @@ static boolean NET_SDL_InitServer(void) static void NET_SDL_SendPacket(net_addr_t *addr, net_packet_t *packet) { UDPpacket sdl_packet; - IPaddress *ip = (IPaddress *) addr->handle; + IPaddress ip; + + if (addr == &net_broadcast_addr) + { + ip.host = INADDR_BROADCAST; + ip.port = DEFAULT_PORT; + } + else + { + ip = *((IPaddress *) addr->handle); + } #if 0 { @@ -229,7 +242,7 @@ static void NET_SDL_SendPacket(net_addr_t *addr, net_packet_t *packet) sdl_packet.channel = 0; sdl_packet.data = packet->data; sdl_packet.len = packet->len; - sdl_packet.address = *ip; + sdl_packet.address = ip; if (!SDLNet_UDP_Send(udpsocket, -1, &sdl_packet)) { -- cgit v1.2.3