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.

57 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Player for HL1.
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef DT_UTLVECTOR_SEND_H
  8. #define DT_UTLVECTOR_SEND_H
  9. #pragma once
  10. #include "dt_send.h"
  11. #include "dt_utlvector_common.h"
  12. #define SENDINFO_UTLVECTOR( varName ) #varName, \
  13. offsetof(currentSendDTClass, varName), \
  14. sizeof(((currentSendDTClass*)0)->varName[0]), \
  15. GetEnsureCapacityTemplate( ((currentSendDTClass*)0)->varName )
  16. #define SendPropUtlVectorDataTable( varName, nMaxElements, dataTableName ) \
  17. SendPropUtlVector( \
  18. SENDINFO_UTLVECTOR( varName ), \
  19. nMaxElements, \
  20. SendPropDataTable( NULL, 0, &REFERENCE_SEND_TABLE( dataTableName ) ) \
  21. )
  22. //
  23. // Set it up to transmit a CUtlVector of basic types or of structures.
  24. //
  25. // pArrayProp doesn't need a name, offset, or size. You can pass 0 for all those.
  26. // Example usage:
  27. //
  28. // SendPropUtlVectorDataTable( m_StructArray, 11, DT_TestStruct )
  29. //
  30. // SendPropUtlVector(
  31. // SENDINFO_UTLVECTOR( m_FloatArray ),
  32. // 16, // max elements
  33. // SendPropFloat( NULL, 0, 0, 0, SPROP_NOSCALE )
  34. // )
  35. //
  36. SendProp SendPropUtlVector(
  37. char *pVarName, // Use SENDINFO_UTLVECTOR to generate these first 4 parameters.
  38. int offset,
  39. int sizeofVar,
  40. EnsureCapacityFn ensureFn,
  41. int nMaxElements, // Max # of elements in the array. Keep this as low as possible.
  42. SendProp pArrayProp, // Describe the data inside of each element in the array.
  43. SendTableProxyFn varProxy=SendProxy_DataTableToDataTable // This can be overridden to control who the array is sent to.
  44. );
  45. #endif // DT_UTLVECTOR_SEND_H