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.

69 lines
1.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef NETWORKSTRINGTABLEITEM_H
  8. #define NETWORKSTRINGTABLEITEM_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "utlsymbol.h"
  13. #include "utlvector.h"
  14. #ifdef _XBOX
  15. #define SHARED_NET_STRING_TABLES
  16. #endif
  17. //-----------------------------------------------------------------------------
  18. // Purpose:
  19. //-----------------------------------------------------------------------------
  20. class CNetworkStringTableItem
  21. {
  22. public:
  23. enum
  24. {
  25. MAX_USERDATA_BITS = 14,
  26. MAX_USERDATA_SIZE = (1 << MAX_USERDATA_BITS)
  27. };
  28. struct itemchange_s {
  29. int tick;
  30. int length;
  31. unsigned char *data;
  32. };
  33. CNetworkStringTableItem( void );
  34. ~CNetworkStringTableItem( void );
  35. #ifndef SHARED_NET_STRING_TABLES
  36. void EnableChangeHistory( void );
  37. void UpdateChangeList( int tick, int length, const void *userData );
  38. int RestoreTick( int tick );
  39. inline int GetTickCreated( void ) const { return m_nTickCreated; }
  40. #endif
  41. bool SetUserData( int tick, int length, const void *userdata );
  42. const void *GetUserData( int *length=0 );
  43. inline int GetUserDataLength() const { return m_nUserDataLength; }
  44. // Used by server only
  45. // void SetTickCount( int count ) ;
  46. inline int GetTickChanged( void ) const { return m_nTickChanged; }
  47. public:
  48. unsigned char *m_pUserData;
  49. int m_nUserDataLength;
  50. int m_nTickChanged;
  51. #ifndef SHARED_NET_STRING_TABLES
  52. int m_nTickCreated;
  53. CUtlVector< itemchange_s > *m_pChangeList;
  54. #endif
  55. };
  56. #endif // NETWORKSTRINGTABLEITEM_H