diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/mapentities_shared.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/shared/mapentities_shared.h')
| -rw-r--r-- | game/shared/mapentities_shared.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/game/shared/mapentities_shared.h b/game/shared/mapentities_shared.h new file mode 100644 index 0000000..fee9f0d --- /dev/null +++ b/game/shared/mapentities_shared.h @@ -0,0 +1,50 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#ifndef MAPENTITIES_SHARED_H +#define MAPENTITIES_SHARED_H +#ifdef _WIN32 +#pragma once +#endif + +#define MAPKEY_MAXLENGTH 2048 + + +//----------------------------------------------------------------------------- +// Purpose: encapsulates the data string in the map file +// that is used to initialise entities. The data +// string contains a set of key/value pairs. +//----------------------------------------------------------------------------- +class CEntityMapData +{ +private: + char *m_pEntData; + int m_nEntDataSize; + char *m_pCurrentKey; + +public: + explicit CEntityMapData( char *entBlock, int nEntBlockSize = -1 ) : + m_pEntData(entBlock), m_nEntDataSize(nEntBlockSize), m_pCurrentKey(entBlock) {} + + // find the keyName in the entdata and puts it's value into Value. returns false if key is not found + bool ExtractValue( const char *keyName, char *Value ); + + // find the nth keyName in the endata and change its value to specified one + // where n == nKeyInstance + bool SetValue( const char *keyName, char *NewValue, int nKeyInstance = 0 ); + + bool GetFirstKey( char *keyName, char *Value ); + bool GetNextKey( char *keyName, char *Value ); + + const char *CurrentBufferPosition( void ); +}; + +const char *MapEntity_ParseToken( const char *data, char *newToken ); +const char *MapEntity_SkipToNextEntity( const char *pMapData, char *pWorkBuffer ); +bool MapEntity_ExtractValue( const char *pEntData, const char *keyName, char Value[MAPKEY_MAXLENGTH] ); + + +#endif // MAPENTITIES_SHARED_H |