summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2005-12-29 17:47:47 +0000
committerSimon Howard2005-12-29 17:47:47 +0000
commit68e5d0979584d614868f790e2dcf4e5e186415b0 (patch)
treea7a5606a5795c23cdec1f0183f7a4ff51f33e3be /src
parentef65489cb6abe9cffbf20add190c5480dc8bbb05 (diff)
downloadchocolate-doom-68e5d0979584d614868f790e2dcf4e5e186415b0.tar.gz
chocolate-doom-68e5d0979584d614868f790e2dcf4e5e186415b0.tar.bz2
chocolate-doom-68e5d0979584d614868f790e2dcf4e5e186415b0.zip
Automatically initialise the address table
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 231
Diffstat (limited to 'src')
-rw-r--r--src/net_sdl.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/net_sdl.c b/src/net_sdl.c
index 5eb26dfe..c202673f 100644
--- a/src/net_sdl.c
+++ b/src/net_sdl.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_sdl.c 229 2005-10-30 19:56:15Z fraggle $
+// $Id: net_sdl.c 231 2005-12-29 17:47:47Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -21,6 +21,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.2 2005/12/29 17:47:47 fraggle
+// Automatically initialise the address table
+//
// Revision 1.1 2005/10/30 19:56:15 fraggle
// Add foundation code for the new networking system
//
@@ -59,7 +62,7 @@ typedef struct
} addrpair_t;
static addrpair_t **addr_table;
-static int addr_table_size;
+static int addr_table_size = -1;
// Initialises the address table
@@ -87,6 +90,11 @@ static net_addr_t *NET_SDL_FindAddress(IPaddress *addr)
int empty_entry = -1;
int i;
+ if (addr_table_size < 0)
+ {
+ NET_SDL_InitAddrTable();
+ }
+
for (i=0; i<addr_table_size; ++i)
{
if (addr_table[i] != NULL
@@ -168,7 +176,6 @@ static boolean NET_SDL_InitClient(void)
I_Error("NET_SDL_InitClient: Unable to open a socket!");
}
- NET_SDL_InitAddrTable();
recvpacket = SDLNet_AllocPacket(1500);
return true;
@@ -191,7 +198,6 @@ static boolean NET_SDL_InitServer(void)
I_Error("NET_SDL_InitServer: Unable to bind to port %i", port);
}
- NET_SDL_InitAddrTable();
recvpacket = SDLNet_AllocPacket(1500);
return true;