Skip to content

Commit

Permalink
Only include the delta length when _NETDEBUG defined (i.e., not in no…
Browse files Browse the repository at this point in the history
…rmal debug builds).
  • Loading branch information
skyjake committed Jan 7, 2007
1 parent fabd71d commit bc66e8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
14 changes: 5 additions & 9 deletions doomsday/engine/portable/src/cl_frame.c
Expand Up @@ -208,7 +208,7 @@ void Cl_Frame2Received(int packetType)
byte resendAcks[300];
int i, numResendAcks = 0;
boolean skip = false;
#ifdef _DEBUG
#ifdef _NETDEBUG
int deltaCount = 0;
int startOffset;
int deltaLength;
Expand Down Expand Up @@ -258,24 +258,20 @@ void Cl_Frame2Received(int packetType)
// or ack arrives too late).
if(!Cl_HistoryCheck(set))
{
#ifdef _DEBUG
//int readCount = 0;
#endif

// It isn't yet in the history, so add it there.
Cl_HistoryAdd(set);

VERBOSE2( Con_Printf("Starting to process deltas in set %i.\n", set) );

#ifdef _DEBUG
#ifdef _NETDEBUG
deltaCount = Msg_ReadLong();
VERBOSE2( Con_Message("Set contains %i deltas.\n", deltaCount) );
#endif

// Read and process the message.
while(!Msg_End())
{
#ifdef _DEBUG
#ifdef _NETDEBUG
/*Con_Message("Starting to read delta %i of %i...\n", ++readCount,
deltaCount);*/

Expand All @@ -286,7 +282,7 @@ void Cl_Frame2Received(int packetType)
#endif

deltaType = Msg_ReadByte();
#ifdef _DEBUG
#ifdef _NETDEBUG
//Con_Message(" Delta type is %i.\n", deltaType & ~DT_RESENT);
#endif
skip = false;
Expand Down Expand Up @@ -378,7 +374,7 @@ void Cl_Frame2Received(int packetType)
deltaType);
}

#ifdef _DEBUG
#ifdef _NETDEBUG
// Check that we didn't misread.
if(Msg_Offset() - startOffset != deltaLength)
{
Expand Down
21 changes: 4 additions & 17 deletions doomsday/engine/portable/src/sv_frame.c
Expand Up @@ -734,12 +734,12 @@ void Sv_WriteDeltaHeader(byte type, const delta_t * delta)
void Sv_WriteDelta(const delta_t * delta)
{
byte type = delta->type;
#ifdef _DEBUG
#ifdef _NETDEBUG
int lengthOffset;
int endOffset;
#endif

#ifdef _DEBUG
#ifdef _NETDEBUG
// Extra length field in debug builds.
lengthOffset = Msg_Offset();
Msg_WriteLong(0);
Expand All @@ -753,25 +753,12 @@ void Sv_WriteDelta(const delta_t * delta)
// This'll be the entire delta. No more data is needed.
Sv_WriteDeltaHeader(DT_NULL_MOBJ, delta);
Msg_WriteShort(delta->id);
#ifdef _DEBUG
#ifdef _NETDEBUG
goto writeDeltaLength;
#else
return;
#endif
}

#if 0
if(delta->flags & MDFC_CREATE)
{
// This mobj was just created, let's use a different
// delta type number.
type = DT_CREATE_MOBJ;
/*#ifdef _DEBUG
Con_Printf("Written: create mo %i [%08x, s%i]\n", delta->id,
delta->flags, delta->state);
#endif */
}
#endif
}

// First the type of the delta.
Expand Down Expand Up @@ -814,7 +801,7 @@ void Sv_WriteDelta(const delta_t * delta)
Con_Error("Sv_WriteDelta: Unknown delta type %i.\n", delta->type);
}

#ifdef _DEBUG
#ifdef _NETDEBUG
writeDeltaLength:
// Update the length of the delta.
endOffset = Msg_Offset();
Expand Down

0 comments on commit bc66e8a

Please sign in to comment.