diff --git a/engine/common/net_buffer.c b/engine/common/net_buffer.c index 653e3a7a..6b6b8791 100644 --- a/engine/common/net_buffer.c +++ b/engine/common/net_buffer.c @@ -94,14 +94,13 @@ void MSG_Clear( sizebuf_t *sb ) sb->bOverflow = false; } -#if XASH_EXT_OPT != 2 static qboolean MSG_Overflow( sizebuf_t *sb, int nBits ) { if( sb->iCurBit + nBits > sb->nDataBits ) sb->bOverflow = true; return sb->bOverflow; } -#endif + qboolean MSG_CheckOverflow( sizebuf_t *sb ) { return MSG_Overflow( sb, 0 ); diff --git a/engine/common/net_buffer.h b/engine/common/net_buffer.h index 0ad16130..2a953ce9 100644 --- a/engine/common/net_buffer.h +++ b/engine/common/net_buffer.h @@ -71,21 +71,18 @@ void MSG_Clear( sizebuf_t *sb ); // Bit-write functions #if XASH_EXT_OPT == 2 -_inline qboolean MSG_Overflow( sizebuf_t *sb, int nBits ) -{ - if( sb->iCurBit + nBits > sb->nDataBits ) - sb->bOverflow = true; - return sb->bOverflow; -} _inline void MSG_WriteOneBit( sizebuf_t *sb, int nValue ) { - if( !MSG_Overflow( sb, 1 )) + if( sb->iCurBit + 1 > sb->nDataBits ) { - if( nValue ) sb->pData[sb->iCurBit>>3] |= BIT( sb->iCurBit & 7 ); - else sb->pData[sb->iCurBit>>3] &= ~BIT( sb->iCurBit & 7 ); - - sb->iCurBit++; + sb->bOverflow = true; + return; } + + if( nValue ) sb->pData[sb->iCurBit>>3] |= BIT( sb->iCurBit & 7 ); + else sb->pData[sb->iCurBit>>3] &= ~BIT( sb->iCurBit & 7 ); + + sb->iCurBit++; } #else void MSG_WriteOneBit( sizebuf_t *sb, int nValue ); diff --git a/engine/common/net_encode.c b/engine/common/net_encode.c index af7274a4..f18546fb 100644 --- a/engine/common/net_encode.c +++ b/engine/common/net_encode.c @@ -1134,11 +1134,7 @@ write fields by offsets assume from and to is valid ===================== */ -#if XASH_EXT_OPT == 2 -_inline qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to, float timebase ) -#else qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to, float timebase ) -#endif { qboolean bSigned = ( pField->flags & DT_SIGNED ) ? true : false; float flValue, flAngle, flTime;