From d2a4faae6e17b40d1fb8bde5b6848d8da4df241e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 31 May 2001 15:38:08 +0000 Subject: [PATCH] oops :) (packet log fixes: segs aren't nice) --- qw/include/net.h | 2 ++ qw/source/cl_main.c | 9 +++------ qw/source/cl_sys_unix.c | 12 ++++-------- qw/source/cl_sys_win.c | 14 +++++++------- qw/source/sv_main.c | 4 +--- qw/source/sv_sys_unix.c | 4 +--- qw/source/sv_sys_win.c | 4 +--- 7 files changed, 19 insertions(+), 30 deletions(-) diff --git a/qw/include/net.h b/qw/include/net.h index d61b67493..a73e7d8ef 100644 --- a/qw/include/net.h +++ b/qw/include/net.h @@ -136,4 +136,6 @@ extern void Log_Incoming_Packet (char *p, int len); extern void Log_Outgoing_Packet (char *p, int len); extern void Net_LogStop (void); +extern struct cvar_s *net_packetlog; + #endif // _NET_H diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index cbee66fee..053b71a6b 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -63,7 +63,6 @@ #include "QF/cdaudio.h" #include "QF/cmd.h" -#include "compat.h" #include "QF/console.h" #include "QF/cvar.h" #include "QF/draw.h" @@ -82,6 +81,7 @@ #include "QF/va.h" #include "QF/vfs.h" +#include "compat.h" #include "bothdefs.h" #include "buildnum.h" #include "cl_cam.h" @@ -1032,9 +1032,8 @@ CL_ReadPackets (void) // while (NET_GetPacket ()) while (CL_GetMessage ()) { -#ifdef PACKET_LOGGING - if (cls.demoplayback) Log_Incoming_Packet(net_message->message->data,net_message->message->cursize); -#endif + if (cls.demoplayback && net_packetlog->int_val) + Log_Incoming_Packet(net_message->message->data,net_message->message->cursize); // remote command packet if (*(int *) net_message->message->data == -1) { @@ -1633,7 +1632,6 @@ Host_Init (void) NET_Init (cl_port->int_val); Netchan_Init (); -#ifdef PACKET_LOGGING { static char *sound_precache[MAX_MODELS]; int i; @@ -1642,7 +1640,6 @@ Host_Init (void) sound_precache[i] = cl.sound_name[i]; Net_Log_Init (sound_precache); } -#endif W_LoadWadFile ("gfx.wad"); Key_Init (); diff --git a/qw/source/cl_sys_unix.c b/qw/source/cl_sys_unix.c index b8fad0cb1..099bd1e03 100644 --- a/qw/source/cl_sys_unix.c +++ b/qw/source/cl_sys_unix.c @@ -45,18 +45,16 @@ #include #include "QF/cvar.h" -#include "host.h" #include "QF/qargs.h" #include "QF/sys.h" +#include "host.h" +#include "net.h" + int noconinput = 0; qboolean is_server = false; char *svs_info; -#ifdef PACKET_LOGGING -void Net_LogStop (void); -#endif - // General routines ====================================================== @@ -66,9 +64,7 @@ Sys_Quit (void) Host_Shutdown (); fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK); -#ifdef PACKET_LOGGING - Net_LogStop(); -#endif + Net_LogStop(); exit (0); } diff --git a/qw/source/cl_sys_win.c b/qw/source/cl_sys_win.c index 16eb32c82..6f2878d09 100644 --- a/qw/source/cl_sys_win.c +++ b/qw/source/cl_sys_win.c @@ -38,17 +38,19 @@ #include #include -#include "client.h" -#include "compat.h" #include "QF/console.h" -#include "host.h" #include "QF/qargs.h" -#include "resource.h" #include "QF/screen.h" #include "QF/sound.h" #include "QF/sys.h" #include "QF/vid.h" +#include "client.h" +#include "compat.h" +#include "host.h" +#include "net.h" +#include "resource.h" + qboolean is_server = false; char *svs_info; @@ -229,9 +231,7 @@ Sys_Quit (void) if (qwclsemaphore) CloseHandle (qwclsemaphore); -#ifdef PACKET_LOGGING - Net_LogStop(); -#endif + Net_LogStop(); exit (0); } diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 6d5625a48..3970a40a8 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -1891,9 +1891,7 @@ SV_InitNet (void) Netchan_Init (); -#ifdef PACKET_LOGGING - Net_Log_Init(sv.sound_precache); -#endif + Net_Log_Init(sv.sound_precache); // heartbeats will always be sent to the id master svs.last_heartbeat = -99999; // send immediately diff --git a/qw/source/sv_sys_unix.c b/qw/source/sv_sys_unix.c index 380e7c302..8b3e3427b 100644 --- a/qw/source/sv_sys_unix.c +++ b/qw/source/sv_sys_unix.c @@ -92,9 +92,7 @@ void Sys_Quit (void) { -#ifdef PACKET_LOGGING - Net_LogStop(); -#endif + Net_LogStop(); exit (0); // appkit isn't running } diff --git a/qw/source/sv_sys_win.c b/qw/source/sv_sys_win.c index f06783bbb..b30a65f94 100644 --- a/qw/source/sv_sys_win.c +++ b/qw/source/sv_sys_win.c @@ -116,9 +116,7 @@ Sys_ConsoleInput (void) void Sys_Quit (void) { -#ifdef PACKET_LOGGING - Net_LogStop(); -#endif + Net_LogStop(); exit (0); }