Team Fortress 2 Source Code as on 22/4/2020
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

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef NET_SYNCTAGS_H
  8. #define NET_SYNCTAGS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #ifdef _DEBUG
  13. #include <bitbuf.h>
  14. extern ConVar net_synctags;
  15. // SyncTags are used as a debugging tool. If net_synctags is set to 1, then the tags
  16. // are put into the bit streams and verified on the client.
  17. inline void SyncTag_Write( bf_write *pBuf, const char *pTag )
  18. {
  19. if ( net_synctags.GetInt() )
  20. {
  21. pBuf->WriteString( pTag );
  22. }
  23. }
  24. inline void SyncTag_Read( bf_read *pBuf, const char *pWantedTag )
  25. {
  26. if ( net_synctags.GetInt() )
  27. {
  28. char testTag[512];
  29. pBuf->ReadString( testTag, sizeof( testTag ) );
  30. if ( stricmp( testTag, pWantedTag ) != 0 )
  31. {
  32. Error( "SyncTag_Read: out-of-sync at tag %s", pWantedTag );
  33. }
  34. }
  35. }
  36. #else
  37. inline void SyncTag_Write( bf_write *pBuf, const char *pTag ) {}
  38. inline void SyncTag_Read( bf_read *pBuf, const char *pWantedTag ) {}
  39. #endif
  40. #endif // NET_SYNCTAGS_H