Counter Strike : Global Offensive Source Code
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.

60 lines
2.0 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Player for HL1.
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef DT_UTLVECTOR_RECV_H
  8. #define DT_UTLVECTOR_RECV_H
  9. #pragma once
  10. #include "dt_recv.h"
  11. #include "dt_utlvector_common.h"
  12. #define RECVINFO_UTLVECTOR( varName ) #varName, \
  13. offsetof(currentRecvDTClass, varName), \
  14. sizeof(((currentRecvDTClass*)0)->varName[0]), \
  15. GetResizeUtlVectorTemplate( ((currentRecvDTClass*)0)->varName ), \
  16. GetEnsureCapacityTemplate( ((currentRecvDTClass*)0)->varName )
  17. // Use this macro to specify a utlvector where you specify the function
  18. // that gets called to make sure the size of the utlvector is correct.
  19. // The size function looks like this: void ResizeUtlVector( void *pVoid, int len )
  20. #define RECVINFO_UTLVECTOR_SIZEFN( varName, resizeFn ) #varName, \
  21. offsetof(currentRecvDTClass, varName), \
  22. sizeof(((currentRecvDTClass*)0)->varName[0]), \
  23. resizeFn, \
  24. GetEnsureCapacityTemplate( ((currentRecvDTClass*)0)->varName )
  25. #define RecvPropUtlVectorDataTable( varName, nMaxElements, dataTableName ) \
  26. RecvPropUtlVector( RECVINFO_UTLVECTOR( varName ), nMaxElements, RecvPropDataTable(NULL,0,0, &REFERENCE_RECV_TABLE( dataTableName ) ) )
  27. //
  28. // Receive a property sent with SendPropUtlVector.
  29. //
  30. // Example usage:
  31. //
  32. // RecvPropUtlVectorDataTable( m_StructArray, 11, DT_StructArray )
  33. //
  34. // RecvPropUtlVector( RECVINFO_UTLVECTOR( m_FloatArray ), 16, RecvPropFloat(NULL,0,0) )
  35. //
  36. RecvProp RecvPropUtlVector(
  37. char *pVarName, // Use RECVINFO_UTLVECTOR to generate these first 5 parameters.
  38. int offset,
  39. int sizeofVar,
  40. ResizeUtlVectorFn fn,
  41. EnsureCapacityFn ensureFn,
  42. int nMaxElements, // Max # of elements in the array. Keep this as low as possible.
  43. RecvProp pArrayProp // The definition of the property you're receiving into.
  44. // You can leave all of its parameters at 0 (name, offset, size, etc).
  45. );
  46. #endif // DT_UTLVECTOR_RECV_H