summaryrefslogtreecommitdiff
path: root/engine/net_synctags.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/net_synctags.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'engine/net_synctags.h')
-rw-r--r--engine/net_synctags.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/engine/net_synctags.h b/engine/net_synctags.h
new file mode 100644
index 0000000..f4cec03
--- /dev/null
+++ b/engine/net_synctags.h
@@ -0,0 +1,54 @@
+//========= 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