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.

50 lines
1.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef MAPENTITIES_SHARED_H
  7. #define MAPENTITIES_SHARED_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #define MAPKEY_MAXLENGTH 2048
  12. //-----------------------------------------------------------------------------
  13. // Purpose: encapsulates the data string in the map file
  14. // that is used to initialise entities. The data
  15. // string contains a set of key/value pairs.
  16. //-----------------------------------------------------------------------------
  17. class CEntityMapData
  18. {
  19. private:
  20. char *m_pEntData;
  21. int m_nEntDataSize;
  22. char *m_pCurrentKey;
  23. public:
  24. explicit CEntityMapData( char *entBlock, int nEntBlockSize = -1 ) :
  25. m_pEntData(entBlock), m_nEntDataSize(nEntBlockSize), m_pCurrentKey(entBlock) {}
  26. // find the keyName in the entdata and puts it's value into Value. returns false if key is not found
  27. bool ExtractValue( const char *keyName, char *Value );
  28. // find the nth keyName in the endata and change its value to specified one
  29. // where n == nKeyInstance
  30. bool SetValue( const char *keyName, char *NewValue, int nKeyInstance = 0 );
  31. bool GetFirstKey( char *keyName, char *Value );
  32. bool GetNextKey( char *keyName, char *Value );
  33. const char *CurrentBufferPosition( void );
  34. };
  35. const char *MapEntity_ParseToken( const char *data, char *newToken );
  36. const char *MapEntity_SkipToNextEntity( const char *pMapData, char *pWorkBuffer );
  37. bool MapEntity_ExtractValue( const char *pEntData, const char *keyName, char Value[MAPKEY_MAXLENGTH] );
  38. #endif // MAPENTITIES_SHARED_H