diff --git a/qw/source/net_packetlog.c b/qw/source/net_packetlog.c index cbb690075..d4915b748 100644 --- a/qw/source/net_packetlog.c +++ b/qw/source/net_packetlog.c @@ -168,7 +168,7 @@ char *clc_string[] = { #define svc_particle 18 // [vec3] #define svc_signonnum 25 // [byte] used for the signon // sequence - +static VFile _stdout; static VFile *Net_PacketLog; static char **Net_sound_precache; static sizebuf_t _packet; @@ -397,10 +397,16 @@ Log_Delta(int bits) void Analyze_Server_Packet (byte * data, int len) { + if (!Net_PacketLog) { + _stdout.file = stdout; + Net_PacketLog = &_stdout; + } packet.message->data = data; packet.message->cursize = len; MSG_BeginReading (&packet); Parse_Server_Packet (); + if (Net_PacketLog == &_stdout) + Net_PacketLog = NULL; } @@ -850,11 +856,16 @@ Parse_Server_Packet () void Analyze_Client_Packet (byte * data, int len) { - // FIXME: quick-hack + if (!Net_PacketLog) { + _stdout.file = stdout; + Net_PacketLog = &_stdout; + } packet.message->data = data; packet.message->cursize = len; MSG_BeginReading (&packet); Parse_Client_Packet (); + if (Net_PacketLog == &_stdout) + Net_PacketLog = NULL; } void diff --git a/qw/source/sv_send.c b/qw/source/sv_send.c index 2cbac5181..e302a1f0f 100644 --- a/qw/source/sv_send.c +++ b/qw/source/sv_send.c @@ -765,6 +765,9 @@ SV_SendClientMessages (void) // if the reliable message overflowed, // drop the client if (c->netchan.message.overflowed) { + extern void Analyze_Server_Packet (byte *data, int len); + + Analyze_Server_Packet (c->netchan.message.data, c->netchan.message.cursize); SZ_Clear (&c->netchan.message); SZ_Clear (&c->datagram); SV_BroadcastPrintf (PRINT_HIGH, "%s overflowed\n", c->name);