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.

104 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #if !defined( EVENT_SYSTEM_H )
  14. #define EVENT_SYSTEM_H
  15. #ifdef _WIN32
  16. #pragma once
  17. #endif
  18. #include "event_flags.h"
  19. #include "common.h"
  20. #include "enginesingleuserfilter.h"
  21. class SendTable;
  22. class ClientClass;
  23. //-----------------------------------------------------------------------------
  24. // Purpose:
  25. //-----------------------------------------------------------------------------
  26. class CEventInfo
  27. {
  28. public:
  29. enum
  30. {
  31. EVENT_INDEX_BITS = 8,
  32. EVENT_DATA_LEN_BITS = 11,
  33. MAX_EVENT_DATA = 192, // ( 1<<8 bits == 256, but only using 192 below )
  34. };
  35. inline CEventInfo()
  36. {
  37. classID = 0;
  38. fire_delay = 0.0f;
  39. bits = 0;
  40. flags = 0;
  41. pSendTable = NULL;
  42. pClientClass = NULL;
  43. pData = NULL;
  44. }
  45. ~CEventInfo()
  46. {
  47. if ( pData )
  48. {
  49. delete pData;
  50. }
  51. }
  52. CEventInfo( const CEventInfo& src )
  53. {
  54. classID = src.classID;
  55. fire_delay = src.fire_delay;
  56. bits = src.bits;
  57. flags = src.flags;
  58. pSendTable = src.pSendTable;
  59. pClientClass = src.pClientClass;
  60. filter.AddPlayersFromFilter( &src.filter );
  61. if ( src.pData )
  62. {
  63. int size = Bits2Bytes( src.bits );
  64. pData = new byte[size];
  65. Q_memcpy( pData, src.pData, size );
  66. }
  67. else
  68. {
  69. pData = NULL;
  70. }
  71. }
  72. // 0 implies not in use
  73. short classID;
  74. // If non-zero, the delay time when the event should be fired ( fixed up on the client )
  75. float fire_delay;
  76. // send table pointer or NULL if send as full update
  77. const SendTable *pSendTable;
  78. const ClientClass *pClientClass;
  79. // Length of data bits
  80. int bits;
  81. // Raw event data
  82. byte *pData;
  83. // CLIENT ONLY Reliable or not, etc.
  84. int flags;
  85. // clients that see that event
  86. CEngineRecipientFilter filter;
  87. };
  88. #endif // EVENT_SYSTEM_H