You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.1 KiB
54 lines
1.1 KiB
//========= Copyright Valve Corporation, All rights reserved. ============// |
|
// |
|
// Purpose: |
|
// |
|
// $NoKeywords: $ |
|
//=============================================================================// |
|
|
|
#ifndef NET_SYNCTAGS_H |
|
#define NET_SYNCTAGS_H |
|
#ifdef _WIN32 |
|
#pragma once |
|
#endif |
|
|
|
#ifdef _DEBUG |
|
|
|
#include <bitbuf.h> |
|
|
|
extern ConVar net_synctags; |
|
|
|
// SyncTags are used as a debugging tool. If net_synctags is set to 1, then the tags |
|
// are put into the bit streams and verified on the client. |
|
inline void SyncTag_Write( bf_write *pBuf, const char *pTag ) |
|
{ |
|
if ( net_synctags.GetInt() ) |
|
{ |
|
pBuf->WriteString( pTag ); |
|
} |
|
} |
|
|
|
inline void SyncTag_Read( bf_read *pBuf, const char *pWantedTag ) |
|
{ |
|
if ( net_synctags.GetInt() ) |
|
{ |
|
char testTag[512]; |
|
pBuf->ReadString( testTag, sizeof( testTag ) ); |
|
|
|
if ( stricmp( testTag, pWantedTag ) != 0 ) |
|
{ |
|
Error( "SyncTag_Read: out-of-sync at tag %s", pWantedTag ); |
|
} |
|
} |
|
} |
|
|
|
#else |
|
|
|
inline void SyncTag_Write( bf_write *pBuf, const char *pTag ) {} |
|
inline void SyncTag_Read( bf_read *pBuf, const char *pWantedTag ) {} |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#endif // NET_SYNCTAGS_H
|
|
|