mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 12:06:07 +08:00
Various updates to CEntityClass, CEntityInstance & CUtlDict (#196)
This commit is contained in:
@ -2,15 +2,15 @@
|
||||
#include "entitysystem.h"
|
||||
#include "tier1/strtools.h"
|
||||
|
||||
bool CEntityIdentity::NameMatches( const char* szName ) const
|
||||
bool CEntityIdentity::NameMatches( const char* pszNameOrWildcard ) const
|
||||
{
|
||||
if ( szName && szName[0] == '!' )
|
||||
return GameEntitySystem()->FindEntityProcedural( szName ) == m_pInstance;
|
||||
if ( pszNameOrWildcard && pszNameOrWildcard[0] == '!' )
|
||||
return GameEntitySystem()->FindEntityProcedural( pszNameOrWildcard ) == m_pInstance;
|
||||
|
||||
return V_CompareNameWithWildcards( szName, m_name.String() ) == 0;
|
||||
return V_CompareNameWithWildcards( pszNameOrWildcard, m_name.String() ) == 0;
|
||||
}
|
||||
|
||||
bool CEntityIdentity::ClassMatches( const char* szClassName ) const
|
||||
bool CEntityIdentity::ClassMatches( const char* pszClassOrWildcard ) const
|
||||
{
|
||||
return V_CompareNameWithWildcards( szClassName, m_designerName.String() ) == 0;
|
||||
return V_CompareNameWithWildcards( pszClassOrWildcard, m_designerName.String() ) == 0;
|
||||
}
|
||||
|
@ -257,6 +257,8 @@ extern ISaveRestoreOps *eventFuncs;
|
||||
#define DEFINE_FUNCTION( function ) DEFINE_FUNCTION_RAW( function, inputfunc_t )
|
||||
|
||||
|
||||
#define FTYPEDESC_NONE 0
|
||||
|
||||
#define FTYPEDESC_GLOBAL (1 << 0) // This field is masked for global entity save/restore
|
||||
#define FTYPEDESC_SAVE (1 << 1) // This field is saved to disk
|
||||
#define FTYPEDESC_KEY (1 << 2) // This field can be requested and written to by string name at load time
|
||||
@ -275,17 +277,17 @@ extern ISaveRestoreOps *eventFuncs;
|
||||
|
||||
#define FTYPEDESC_INDEX (1 << 12) // The field is an index into file data, used for byteswapping.
|
||||
|
||||
// These flags apply to C_BasePlayer derived objects only
|
||||
#define FTYPEDESC_VIEW_OTHER_PLAYER (1 << 13) // By default you can only view fields on the local player (yourself),
|
||||
// but if this is set, then we allow you to see fields on other players
|
||||
#define FTYPEDESC_VIEW_OWN_TEAM (1 << 14) // Only show this data if the player is on the same team as the local player
|
||||
#define FTYPEDESC_VIEW_NEVER (1 << 15) // Never show this field to anyone, even the local player (unusual)
|
||||
|
||||
#define FTYPEDESC_UNK001 (1 << 16)
|
||||
#define FTYPEDESC_UNK002 (1 << 17)
|
||||
#define FTYPEDESC_UNK003 (1 << 18)
|
||||
#define FTYPEDESC_ALIAS (1 << 19) // Used if the typedesc is an alias prop
|
||||
#define FTYPEDESC_OVERRIDE_RECURSIVE (1 << 13)
|
||||
#define FTYPEDESC_SCHEMA_INITIALIZED (1 << 14)
|
||||
#define FTYPEDESC_GEN_ARRAY_KEYNAMES_0 (1 << 15)
|
||||
#define FTYPEDESC_GEN_ARRAY_KEYNAMES_1 (1 << 16)
|
||||
#define FTYPEDESC_ADDITIONAL_FIELDS (1 << 17)
|
||||
#define FTYPEDESC_EXPLICIT_BASE (1 << 18)
|
||||
#define FTYPEDESC_PROCEDURAL_KEYFIELD (1 << 19)
|
||||
#define FTYPEDESC_ENUM (1 << 20) // Used if the typedesc is enum, no datamap_t info would be available
|
||||
#define FTYPEDESC_REMOVED_KEYFIELD (1 << 21)
|
||||
#define FTYPEDESC_WAS_INPUT (1 << 22)
|
||||
#define FTYPEDESC_WAS_OUTPUT (1 << 23)
|
||||
|
||||
#define TD_MSECTOLERANCE 0.001f // This is a FIELD_FLOAT and should only be checked to be within 0.001 of the networked info
|
||||
|
||||
@ -366,8 +368,8 @@ struct datamap_t
|
||||
char const *dataClassName;
|
||||
datamap_t *baseMap;
|
||||
|
||||
int m_nPackedSize;
|
||||
optimized_datamap_t *m_pOptimizedDataMap;
|
||||
int m_nPackedSize;
|
||||
|
||||
#if defined( _DEBUG )
|
||||
bool bValidityChecked;
|
||||
|
@ -410,7 +410,7 @@ public:
|
||||
|
||||
// Give the list of datatable classes to the engine. The engine matches class names from here with
|
||||
// edict_t::classname to figure out how to encode a class's data for networking
|
||||
virtual ServerClass *GetAllServerClasses( void ) = 0;
|
||||
virtual CUtlVector<ServerClass*> *GetAllServerClasses( void ) = 0;
|
||||
|
||||
virtual const char *GetActiveWorldName( void ) const = 0;
|
||||
|
||||
|
@ -6,31 +6,87 @@
|
||||
#endif
|
||||
|
||||
#include "tier1/utlsymbollarge.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "entity2/entitycomponent.h"
|
||||
#include "entityhandle.h"
|
||||
#include "networksystem/iflattenedserializers.h"
|
||||
|
||||
#define FENTCLASS_NETWORKABLE (1 << 0) // If the EntityClass is networkable
|
||||
#define FENTCLASS_NON_NETWORKABLE (1 << 0) // If the EntityClass is non-networkable
|
||||
#define FENTCLASS_ALIAS (1 << 1) // If the EntityClass is an alias
|
||||
#define FENTCLASS_NO_SPAWNGROUP (1 << 2) // Don't use spawngroups when creating entity
|
||||
#define FENTCLASS_FORCE_EHANDLE (1 << 3) // Forces m_requiredEHandle on created entities
|
||||
#define FENTCLASS_UNK004 (1 << 4)
|
||||
#define FENTCLASS_UNK005 (1 << 5)
|
||||
#define FENTCLASS_SUSPEND_OUTSIDE_PVS (1 << 5) // Suspend entities outside of PVS
|
||||
#define FENTCLASS_ANONYMOUS (1 << 6) // If the EntityClass is anonymous
|
||||
#define FENTCLASS_UNK007 (1 << 7)
|
||||
#define FENTCLASS_UNK008 (1 << 8)
|
||||
#define FENTCLASS_UNK009 (1 << 9)
|
||||
#define FENTCLASS_FORCE_WORLDGROUPID (1 << 10) // Forces worldgroupid to be 1 on created entities
|
||||
|
||||
class CEntityClassInfo;
|
||||
class CEntityClass;
|
||||
class CEntityIdentity;
|
||||
class ServerClass;
|
||||
struct EntInput_t;
|
||||
struct EntOutput_t;
|
||||
struct EntClassComponentOverride_t;
|
||||
struct datamap_t;
|
||||
|
||||
struct EntClassComponentOverride_t
|
||||
{
|
||||
const char* pszBaseComponent;
|
||||
const char* pszOverrideComponent;
|
||||
};
|
||||
|
||||
class CEntityClassInfo
|
||||
{
|
||||
public:
|
||||
const char* m_pszClassname;
|
||||
const char* m_pszCPPClassname;
|
||||
const char* m_pszDescription;
|
||||
CEntityClass *m_pClass;
|
||||
CEntityClassInfo *m_pBaseClassInfo;
|
||||
void* m_pSchemaBinding;
|
||||
datamap_t* m_pDataDescMap;
|
||||
datamap_t* m_pPredDescMap;
|
||||
};
|
||||
|
||||
// Size: 0x110
|
||||
class CEntityClass
|
||||
{
|
||||
struct ComponentOffsets_t
|
||||
{
|
||||
uint16 m_nOffset;
|
||||
};
|
||||
|
||||
struct ComponentHelper_t
|
||||
{
|
||||
size_t m_nOffset;
|
||||
CEntityComponentHelper* m_pComponentHelper;
|
||||
};
|
||||
|
||||
struct ClassInputInfo_t
|
||||
{
|
||||
CUtlSymbolLarge m_sName;
|
||||
EntInput_t* m_pInput;
|
||||
};
|
||||
|
||||
struct ClassOutputInfo_t
|
||||
{
|
||||
CUtlSymbolLarge m_sName;
|
||||
EntOutput_t* m_pOutput;
|
||||
};
|
||||
|
||||
public:
|
||||
inline datamap_t *GetDataDescMap() const
|
||||
{
|
||||
return m_pClassInfo->m_pDataDescMap;
|
||||
}
|
||||
|
||||
public:
|
||||
void* m_pScriptDesc; // 0x0
|
||||
EntInput_t* m_pInputs; // 0x8
|
||||
EntOutput_t* m_pOutputs; // 0x10
|
||||
int m_nInputCount; // 0x18
|
||||
int m_nOutputCount; // 0x1C
|
||||
int m_nOutputCount; // 0x1c
|
||||
EntClassComponentOverride_t* m_pComponentOverrides; // 0x20
|
||||
CEntityClassInfo* m_pClassInfo; // 0x28
|
||||
CEntityClassInfo* m_pBaseClassInfo; // 0x30
|
||||
@ -38,10 +94,25 @@ public:
|
||||
|
||||
// Uses FENTCLASS_* flags
|
||||
uint m_flags; // 0x40
|
||||
private:
|
||||
uint8 pad68[0xB4]; // 0x44
|
||||
public:
|
||||
CEntityClass* m_pNext; // 0xF8
|
||||
|
||||
// Special class group?
|
||||
int m_Unk1; // 0x44
|
||||
|
||||
uint m_nAllHelpersFlags; // 0x48
|
||||
|
||||
CUtlVector<ComponentOffsets_t> m_ComponentOffsets; // 0x50
|
||||
CUtlVector<ComponentHelper_t> m_AllHelpers; // 0x68
|
||||
|
||||
ComponentUnserializerClassInfo_t m_componentUnserializerClassInfo; // 0x80
|
||||
|
||||
FlattenedSerializerDesc_t m_flattenedSerializer; // 0xb0
|
||||
|
||||
CUtlVector<ClassInputInfo_t> m_classInputInfos; // 0xc0
|
||||
CUtlVector<ClassOutputInfo_t> m_classOutputInfos; // 0xd8
|
||||
|
||||
CEntityHandle m_requiredEHandle; // 0xf0
|
||||
|
||||
CEntityClass* m_pNext; // 0xf8
|
||||
CEntityIdentity* m_pFirstEntity; // 0x100
|
||||
ServerClass* m_pServerClass; // 0x108
|
||||
};
|
||||
|
@ -5,9 +5,86 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include <tier0/platform.h>
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlsymbollarge.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "datamap.h"
|
||||
|
||||
class CEntityIdentity;
|
||||
class CEntityComponentHelper;
|
||||
struct ComponentUnserializerClassInfo_t;
|
||||
struct EntOutput_t;
|
||||
|
||||
struct ComponentUnserializerKeyNamesChunk_t
|
||||
{
|
||||
CUtlStringToken m_keyNames[4];
|
||||
};
|
||||
|
||||
struct ComponentUnserializerFieldInfo_t
|
||||
{
|
||||
void* m_pSchemaEnum;
|
||||
const char* m_pKeyName;
|
||||
|
||||
uint16 m_nOffset;
|
||||
uint16 m_nArraySize;
|
||||
|
||||
fieldtype_t m_Type;
|
||||
|
||||
bool m_bUnserializeAsMatrix : 1;
|
||||
bool m_bArrayElement : 1;
|
||||
bool m_bRemovedKeyField : 1;
|
||||
};
|
||||
|
||||
struct ComponentUnserializerPtrToClassInfo_t
|
||||
{
|
||||
uint m_nOffset;
|
||||
ComponentUnserializerClassInfo_t* m_pClassInfo;
|
||||
};
|
||||
|
||||
struct ComponentUnserializerClassInfo_t
|
||||
{
|
||||
ComponentUnserializerClassInfo_t* m_pBaseClassInfo;
|
||||
|
||||
ComponentUnserializerKeyNamesChunk_t* m_pKeyNamesChunks;
|
||||
ComponentUnserializerFieldInfo_t* m_pFieldInfos;
|
||||
EntOutput_t* m_pOutputs;
|
||||
ComponentUnserializerPtrToClassInfo_t* m_pClassInfoPtrs;
|
||||
|
||||
uint16 m_nFieldInfoCount;
|
||||
uint16 m_nKeyNamesChunkCount;
|
||||
uint16 m_nOutputCount;
|
||||
uint16 m_nClassInfoPtrCount;
|
||||
};
|
||||
|
||||
struct EntComponentInfo_t
|
||||
{
|
||||
const char* m_pName;
|
||||
const char* m_pCPPClassname;
|
||||
const char* m_pNetworkDataReferencedDescription;
|
||||
const char* m_pNetworkDataReferencedPtrPropDescription;
|
||||
int m_nRuntimeIndex;
|
||||
uint m_nFlags;
|
||||
ComponentUnserializerClassInfo_t m_componentUnserializerClassInfo;
|
||||
void* m_pScriptDesc;
|
||||
CEntityComponentHelper* m_pBaseClassComponentHelper;
|
||||
};
|
||||
|
||||
class CEntityComponentHelper
|
||||
{
|
||||
public:
|
||||
virtual void Schema_DynamicBinding(void**) = 0;
|
||||
virtual void Finalize() = 0;
|
||||
virtual void GetSchemaBinding(void**) = 0;
|
||||
virtual datamap_t* GetDataDescMap() = 0;
|
||||
virtual bool Allocate( CEntityIdentity* pEntity, void* pComponent ) = 0;
|
||||
virtual void Free( CEntityIdentity* pEntity, void* pComponent ) = 0;
|
||||
|
||||
public:
|
||||
uint m_flags;
|
||||
EntComponentInfo_t* m_pInfo;
|
||||
int m_nPriority;
|
||||
CEntityComponentHelper* m_pNext;
|
||||
};
|
||||
|
||||
class CEntityComponent
|
||||
{
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlsymbollarge.h"
|
||||
#include "entitycomponent.h"
|
||||
#include "entity2/entitycomponent.h"
|
||||
#include "entityhandle.h"
|
||||
|
||||
class CEntityClass;
|
||||
@ -19,6 +19,9 @@ class CEntityInstance;
|
||||
|
||||
struct ChangeAccessorFieldPathIndex_t
|
||||
{
|
||||
ChangeAccessorFieldPathIndex_t() { m_Value = -1; }
|
||||
ChangeAccessorFieldPathIndex_t( int16 value ) { m_Value = value; }
|
||||
|
||||
int16 m_Value;
|
||||
};
|
||||
|
||||
@ -62,6 +65,7 @@ enum EntityFlags_t : uint32
|
||||
EF_HAS_BEEN_UNSERIALIZED = 0x1000,
|
||||
EF_IS_SUSPENDED = 0x2000,
|
||||
EF_IS_ANONYMOUS_ALLOCATION = 0x4000,
|
||||
EF_SUSPEND_OUTSIDE_PVS = 0x8000,
|
||||
};
|
||||
|
||||
// Size: 0x78
|
||||
@ -86,14 +90,12 @@ public:
|
||||
return m_EHandle.GetEntryIndex();
|
||||
}
|
||||
|
||||
bool NameMatches( const char* szName ) const;
|
||||
bool ClassMatches( const char* szClassName ) const;
|
||||
bool NameMatches( const char* pszNameOrWildcard ) const;
|
||||
bool ClassMatches( const char* pszClassOrWildcard ) const;
|
||||
|
||||
public:
|
||||
CEntityInstance* m_pInstance; // 0x0
|
||||
private:
|
||||
CEntityClass* m_pClass; // 0x8
|
||||
public:
|
||||
CEntityHandle m_EHandle; // 0x10
|
||||
int32 m_nameStringableIndex; // 0x14
|
||||
CUtlSymbolLarge m_name; // 0x18
|
||||
|
@ -5,16 +5,77 @@
|
||||
#endif
|
||||
|
||||
#include "tier1/utlsymbollarge.h"
|
||||
#include "entitycomponent.h"
|
||||
#include "entity2/entitycomponent.h"
|
||||
#include "entity2/entityidentity.h"
|
||||
|
||||
class CEntityKeyValues;
|
||||
class CFieldPath;
|
||||
class ISave;
|
||||
class IRestore;
|
||||
struct CEntityPrecacheContext;
|
||||
struct ChangeAccessorFieldPathIndexInfo_t;
|
||||
struct datamap_t;
|
||||
|
||||
class CEntityInstance
|
||||
{
|
||||
public:
|
||||
virtual void* GetScriptDesc() = 0;
|
||||
|
||||
virtual ~CEntityInstance() = 0;
|
||||
|
||||
virtual void Connect() = 0;
|
||||
virtual void Precache( const CEntityPrecacheContext* pContext ) = 0;
|
||||
virtual void AddedToEntityDatabase() = 0;
|
||||
virtual void Spawn( const CEntityKeyValues* pKeyValues ) = 0;
|
||||
virtual void PostDataUpdate( /*DataUpdateType_t*/int updateType ) = 0;
|
||||
virtual void Activate( /*ActivateType_t*/int activateType ) = 0;
|
||||
virtual void UpdateOnRemove() = 0;
|
||||
virtual void OnSetDormant( /*EntityDormancyType_t*/int prevDormancyType, /*EntityDormancyType_t*/int newDormancyType ) = 0;
|
||||
|
||||
virtual void unk001() = 0;
|
||||
virtual void unk002() = 0;
|
||||
virtual void unk003() = 0;
|
||||
|
||||
virtual void DrawEntityDebugOverlays( uint64 debug_bits ) = 0;
|
||||
virtual void DrawDebugTextOverlays( void* unk, uint64 debug_bits, int flags ) = 0;
|
||||
|
||||
virtual int Save( ISave &save ) = 0;
|
||||
virtual int Restore( IRestore &restore ) = 0;
|
||||
virtual void OnSave() = 0;
|
||||
virtual void OnRestore() = 0;
|
||||
|
||||
virtual int ObjectCaps() = 0;
|
||||
virtual CEntityIndex RequiredEdictIndex() = 0;
|
||||
|
||||
// marks an entire entity for transmission over the network
|
||||
virtual void NetworkStateChanged() = 0;
|
||||
|
||||
// marks a field for transmission over the network
|
||||
// nOffset is the flattened field offset
|
||||
// calculated taking into account embedded structures
|
||||
// if PathIndex is specified, then the offset must start from the last object in the chain
|
||||
// nItem is the index of the array element
|
||||
// if the field is a CNetworkUtlVectorBase, otherwise pass -1
|
||||
// PathIndex is the value to specify
|
||||
// if the path to the field goes through one or more pointers, otherwise pass -1
|
||||
// this value is usually a member of the CNetworkVarChainer and belongs to the last object in the chain
|
||||
virtual void NetworkStateChanged( uint nOffset, int nItem = -1, ChangeAccessorFieldPathIndex_t PathIndex = ChangeAccessorFieldPathIndex_t() ) = 0;
|
||||
|
||||
virtual void LogFieldInfo( const char* pszFieldName, const char* pszInfo ) = 0;
|
||||
virtual bool FullEdictChanged() = 0;
|
||||
virtual void unk101() = 0;
|
||||
virtual ChangeAccessorFieldPathIndex_t AddChangeAccessorPath( const CFieldPath& path ) = 0;
|
||||
virtual void AssignChangeAccessorPathIds() = 0;
|
||||
virtual ChangeAccessorFieldPathIndexInfo_t* GetChangeAccessorPathInfo_1() = 0;
|
||||
virtual ChangeAccessorFieldPathIndexInfo_t* GetChangeAccessorPathInfo_2() = 0;
|
||||
|
||||
virtual void unk201() = 0;
|
||||
virtual void ReloadPrivateScripts() = 0;
|
||||
virtual datamap_t* GetDataDescMap() = 0;
|
||||
virtual void unk301() = 0;
|
||||
virtual void Schema_DynamicBinding(void**) = 0;
|
||||
|
||||
public:
|
||||
virtual ~CEntityInstance() = 0;
|
||||
|
||||
inline CEntityHandle GetRefEHandle() const
|
||||
{
|
||||
return m_pEntity->GetRefEHandle();
|
||||
@ -30,12 +91,13 @@ public:
|
||||
return m_pEntity->GetEntityIndex();
|
||||
}
|
||||
|
||||
public:
|
||||
CUtlSymbolLarge m_iszPrivateVScripts; // 0x8
|
||||
CEntityIdentity* m_pEntity; // 0x10
|
||||
private:
|
||||
void* m_hPrivateScope; // 0x18 - CEntityPrivateScriptScope
|
||||
uint8 __pad001[0x8]; // 0x20
|
||||
public:
|
||||
CEntityKeyValues* m_pKeyValues; // 0x20
|
||||
CScriptComponent* m_CScriptComponent; // 0x28
|
||||
};
|
||||
|
||||
@ -45,7 +107,7 @@ public:
|
||||
|
||||
inline bool CEntityHandle::operator <( const CEntityInstance *pEntity ) const
|
||||
{
|
||||
unsigned long otherIndex = (pEntity) ? pEntity->GetRefEHandle().m_Index : INVALID_EHANDLE_INDEX;
|
||||
uint32 otherIndex = (pEntity) ? pEntity->GetRefEHandle().m_Index : INVALID_EHANDLE_INDEX;
|
||||
return m_Index < otherIndex;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "tier1/utldict.h"
|
||||
#include "tier1/utlmap.h"
|
||||
#include "tier1/utlhashtable.h"
|
||||
#include <tier1/utldelegate.h>
|
||||
#include "tier1/utldelegate.h"
|
||||
#include "tier1/utlscratchmemory.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "networksystem/inetworkserializer.h"
|
||||
@ -255,8 +255,8 @@ class CEntitySystem : public IEntityResourceManifestBuilder
|
||||
|
||||
struct DormancyChangeInfo_t
|
||||
{
|
||||
CEntityInstance* m_pEnt;
|
||||
bool m_bDormant;
|
||||
CEntityHandle m_hEnt;
|
||||
bool m_bInPVS;
|
||||
};
|
||||
|
||||
struct MurmurHash2HashFunctor
|
||||
@ -271,7 +271,7 @@ public:
|
||||
virtual void OnEntityParentChanged(CEntityInstance* pEntity, CEntityInstance* pNewParent) = 0; // empty function
|
||||
virtual void OnAddEntity(CEntityInstance* pEnt, CEntityHandle handle) = 0; // empty function
|
||||
virtual void OnRemoveEntity(CEntityInstance* pEnt, CEntityHandle handle) = 0; // empty function
|
||||
virtual int GetSpawnGroupWorldId(SpawnGroupHandle_t hSpawnGroup) = 0; // returns 0
|
||||
virtual WorldGroupId_t GetSpawnGroupWorldId(SpawnGroupHandle_t hSpawnGroup) = 0;
|
||||
virtual void Spawn(int nCount, const EntitySpawnInfo_t* pInfo) = 0;
|
||||
virtual void Activate(int nCount, const EntityActivation_t* pActivates, ActivateType_t activateType) = 0;
|
||||
virtual void PostDataUpdate(int nCount, const PostDataUpdateInfo_t *pInfo) = 0;
|
||||
@ -324,21 +324,21 @@ public:
|
||||
CUtlMap<CUtlSymbolLarge, CUtlVector<CEntityHandle>*> m_entityNames; // 2800
|
||||
CEventQueue m_EventQueue; // 2832
|
||||
CUtlVectorFixedGrowable<IEntityIONotify*, 2> m_entityIONotifiers; // 2968 | 2984
|
||||
int m_Unk1; // 3008 | 3024
|
||||
int m_nSuppressDormancyChangeCount; // 3008 | 3024
|
||||
NetworkSerializationMode_t m_eNetworkSerializationMode; // 3012 | 3028
|
||||
int m_Unk2; // 3016 | 3032
|
||||
int m_Unk3; // 3020 | 3036
|
||||
int m_Unk4; // 3024 | 3040
|
||||
int m_Unk5; // 3028 | 3044
|
||||
int m_nExecuteQueuedCreationDepth; // 3016 | 3032
|
||||
int m_nExecuteQueuedDeletionDepth; // 3020 | 3036
|
||||
int m_nSuppressDestroyImmediateCount; // 3024 | 3040
|
||||
int m_nSuppressAutoDeletionExecutionCount; // 3028 | 3044
|
||||
int m_nEntityKeyValuesAllocatorRefCount; // 3032 | 3048
|
||||
float m_flChangeCallbackSpewThreshold; // 3036 | 3052
|
||||
bool m_Unk6; // 3040 | 3056
|
||||
bool m_Unk7; // 3041 | 3057
|
||||
bool m_Unk8; // 3042 | 3058
|
||||
bool m_Unk9; // 3043 | 3059
|
||||
bool m_Unk10; // 3044 | 3060
|
||||
bool m_Unk11; // 3045 | 3061
|
||||
bool m_Unk12; // 3046 | 3062
|
||||
bool m_Unk1; // 3040 | 3056
|
||||
bool m_Unk2; // 3041 | 3057
|
||||
bool m_Unk3; // 3042 | 3058
|
||||
bool m_bEnableAutoDeletionExecution; // 3043 | 3059
|
||||
bool m_Unk4; // 3044 | 3060
|
||||
bool m_Unk5; // 3045 | 3061
|
||||
bool m_Unk6; // 3046 | 3062
|
||||
CUtlVector<CreationInfo_t> m_queuedCreations; // 3048 | 3064
|
||||
CUtlVector<PostDataUpdateInfo_t> m_queuedPostDataUpdates; // 3072 | 3088
|
||||
CUtlVector<DestructionInfo_t> m_queuedDeletions; // 3096 | 3112
|
||||
@ -384,7 +384,7 @@ public:
|
||||
CUtlVector<IEntityListener*> m_entityListeners; // 5448 | 5496
|
||||
IEntity2SaveRestore* m_pEntity2SaveRestore; // 5472 | 5520
|
||||
IEntity2Networkables* m_pEntity2Networkables; // 5480 | 5528
|
||||
bool m_Unk13; // 5488 | 5536
|
||||
bool m_Unk7; // 5488 | 5536
|
||||
};
|
||||
|
||||
abstract_class IEntityFindFilter
|
||||
|
19
public/networksystem/iflattenedserializers.h
Normal file
19
public/networksystem/iflattenedserializers.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef FLATTENEDSERIALIZERS_H
|
||||
#define FLATTENEDSERIALIZERS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier0/basetypes.h"
|
||||
#include "tier1/utlsymbollarge.h"
|
||||
|
||||
DECLARE_POINTER_HANDLE( FlattenedSerializerHandle_t );
|
||||
|
||||
struct FlattenedSerializerDesc_t
|
||||
{
|
||||
CUtlSymbolLarge m_name;
|
||||
FlattenedSerializerHandle_t m_handle;
|
||||
};
|
||||
|
||||
#endif /* FLATTENEDSERIALIZERS_H */
|
@ -15,14 +15,10 @@
|
||||
|
||||
#include "tier0/dbg.h"
|
||||
#include "dt_send.h"
|
||||
#include "entityclass.h"
|
||||
#include "utlstring.h"
|
||||
#include "networkstringtabledefs.h"
|
||||
#include "networksystem/iflattenedserializers.h"
|
||||
|
||||
DECLARE_POINTER_HANDLE( FlattenedSerializerHandle_t );
|
||||
|
||||
// Non-implemented classes/structs
|
||||
class INetworkProceduralDataHelper;
|
||||
class CEntityClass;
|
||||
|
||||
class ServerClass
|
||||
{
|
||||
@ -30,20 +26,22 @@ public:
|
||||
const char* GetName() { return m_pNetworkName; }
|
||||
|
||||
public:
|
||||
const char *m_pDLLClassName; // On the server this matches the m_pNetworkName, on the client it is prefixed with C_*
|
||||
const char *m_pNetworkName;
|
||||
const char *m_pDescription;
|
||||
|
||||
CEntityClass *m_pEntityClass;
|
||||
|
||||
const char *m_szLibraryName;
|
||||
FlattenedSerializerDesc_t m_flattenedSerializer;
|
||||
|
||||
INetworkProceduralDataHelper *m_pNetworkProceduralDataHelper;
|
||||
FlattenedSerializerHandle_t m_hSerializer;
|
||||
int m_ClassID;
|
||||
|
||||
// This is an index into the network string table (sv.GetInstanceBaselineTable()).
|
||||
int m_InstanceBaselineIndex; // INVALID_STRING_INDEX if not initialized yet.
|
||||
|
||||
int m_ClassID;
|
||||
CUtlString m_ClassIDString;
|
||||
bool m_Unk1;
|
||||
bool m_Unk2; // Set if one of the base classes has the FENTCLASS_UNK008 flag
|
||||
bool m_Unk3; // Set if one of the base classes has the FENTCLASS_UNK009 flag
|
||||
bool m_Unk4;
|
||||
};
|
||||
|
||||
|
||||
|
@ -55,54 +55,16 @@ struct KV3ID_t
|
||||
uint64 m_data2;
|
||||
};
|
||||
|
||||
const KV3ID_t g_KV3Encoding_Text =
|
||||
{
|
||||
"text",
|
||||
0x41C58A33E21C7F3Cull,
|
||||
0xDAA323A6DA77799ull
|
||||
};
|
||||
// encodings
|
||||
const KV3ID_t g_KV3Encoding_Text = { "text", 0x41C58A33E21C7F3Cull, 0xDAA323A6DA77799ull };
|
||||
const KV3ID_t g_KV3Encoding_Binary = { "binary", 0x40C1F7D81B860500ull, 0x14E76782A47582ADull };
|
||||
const KV3ID_t g_KV3Encoding_BinaryLZ4 = { "binary_lz4", 0x4F5C63A16847348Aull, 0x19B1D96F805397A1ull };
|
||||
const KV3ID_t g_KV3Encoding_BinaryZSTD = { "binary_zstd", 0x4305FEF06F620A00ull, 0x29DBB14623045FA3ull };
|
||||
const KV3ID_t g_KV3Encoding_BinaryBC = { "binary_bc", 0x4F6C95BC95791A46ull, 0xD2DFB7A1BC050BA7ull };
|
||||
const KV3ID_t g_KV3Encoding_BinaryAuto = { "binary_auto", 0x45836B856EB109E6ull, 0x8C06046E3A7012A3ull };
|
||||
|
||||
const KV3ID_t g_KV3Encoding_Binary =
|
||||
{
|
||||
"binary",
|
||||
0x40C1F7D81B860500ull,
|
||||
0x14E76782A47582ADull
|
||||
};
|
||||
|
||||
const KV3ID_t g_KV3Encoding_BinaryLZ4 =
|
||||
{
|
||||
"binary_lz4",
|
||||
0x4F5C63A16847348Aull,
|
||||
0x19B1D96F805397A1ull
|
||||
};
|
||||
|
||||
const KV3ID_t g_KV3Encoding_BinaryZSTD =
|
||||
{
|
||||
"binary_zstd",
|
||||
0x4305FEF06F620A00ull,
|
||||
0x29DBB14623045FA3ull
|
||||
};
|
||||
|
||||
const KV3ID_t g_KV3Encoding_BinaryBC =
|
||||
{
|
||||
"binary_bc",
|
||||
0x4F6C95BC95791A46ull,
|
||||
0xD2DFB7A1BC050BA7ull
|
||||
};
|
||||
|
||||
const KV3ID_t g_KV3Encoding_BinaryAuto =
|
||||
{
|
||||
"binary_auto",
|
||||
0x45836B856EB109E6ull,
|
||||
0x8C06046E3A7012A3ull
|
||||
};
|
||||
|
||||
const KV3ID_t g_KV3Format_Generic =
|
||||
{
|
||||
"generic",
|
||||
0x469806E97412167Cull,
|
||||
0xE73790B53EE6F2AFull
|
||||
};
|
||||
// formats
|
||||
const KV3ID_t g_KV3Format_Generic = { "generic", 0x469806E97412167Cull, 0xE73790B53EE6F2AFull };
|
||||
|
||||
enum KV1TextEscapeBehavior_t
|
||||
{
|
||||
|
@ -28,17 +28,29 @@ enum EDictCompareType
|
||||
k_eDictCompareTypeFilenames // Slashes and backslashes count as the same character..
|
||||
};
|
||||
|
||||
template <int COMPARE_TYPE> struct CDictCompareTypeDeducer {};
|
||||
template <> struct CDictCompareTypeDeducer<k_eDictCompareTypeCaseSensitive> { typedef CDefStringLess Type_t; };
|
||||
template <> struct CDictCompareTypeDeducer<k_eDictCompareTypeCaseInsensitive> { typedef CDefCaselessStringLess Type_t; };
|
||||
template <> struct CDictCompareTypeDeducer<k_eDictCompareTypeFilenames> { typedef CDefCaselessStringLessIgnoreSlashes Type_t; };
|
||||
|
||||
#define FOR_EACH_DICT( dictName, iteratorName ) \
|
||||
for( int iteratorName=dictName.First(); iteratorName != dictName.InvalidIndex(); iteratorName = dictName.Next( iteratorName ) )
|
||||
|
||||
// faster iteration, but in an unspecified order
|
||||
#define FOR_EACH_DICT_FAST( dictName, iteratorName ) \
|
||||
for ( int iteratorName = 0; iteratorName < dictName.MaxElement(); ++iteratorName ) if ( !dictName.IsValidIndex( iteratorName ) ) continue; else
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A dictionary mapping from symbol to structure
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I = int >
|
||||
template <class T, class I = int, int COMPARE_TYPE = k_eDictCompareTypeCaseInsensitive>
|
||||
class CUtlDict
|
||||
{
|
||||
public:
|
||||
// constructor, destructor
|
||||
// Left at growSize = 0, the memory will first allocate 1 element and double in size
|
||||
// at each increment.
|
||||
CUtlDict( int compareType = k_eDictCompareTypeCaseInsensitive, int growSize = 0, int initSize = 0 );
|
||||
CUtlDict( int growSize = 0, int initSize = 0 );
|
||||
~CUtlDict( );
|
||||
|
||||
void EnsureCapacity( int );
|
||||
@ -89,7 +101,7 @@ public:
|
||||
typedef I IndexType_t;
|
||||
|
||||
protected:
|
||||
typedef CUtlMap<const char *, T, I> DictElementMap_t;
|
||||
typedef CUtlMap<const char *, T, I, typename CDictCompareTypeDeducer<COMPARE_TYPE>::Type_t> DictElementMap_t;
|
||||
DictElementMap_t m_Elements;
|
||||
};
|
||||
|
||||
@ -97,31 +109,19 @@ protected:
|
||||
//-----------------------------------------------------------------------------
|
||||
// constructor, destructor
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
CUtlDict<T, I>::CUtlDict( int compareType, int growSize, int initSize ) : m_Elements( growSize, initSize )
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
CUtlDict<T, I, COMPARE_TYPE>::CUtlDict( int growSize, int initSize ) : m_Elements( growSize, initSize )
|
||||
{
|
||||
if ( compareType == k_eDictCompareTypeFilenames )
|
||||
{
|
||||
m_Elements.SetLessFunc( CaselessStringLessThanIgnoreSlashes );
|
||||
}
|
||||
else if ( compareType == k_eDictCompareTypeCaseInsensitive )
|
||||
{
|
||||
m_Elements.SetLessFunc( CaselessStringLessThan );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Elements.SetLessFunc( StringLessThan );
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
CUtlDict<T, I>::~CUtlDict()
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
CUtlDict<T, I, COMPARE_TYPE>::~CUtlDict()
|
||||
{
|
||||
Purge();
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
inline void CUtlDict<T, I>::EnsureCapacity( int num )
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline void CUtlDict<T, I, COMPARE_TYPE>::EnsureCapacity( int num )
|
||||
{
|
||||
return m_Elements.EnsureCapacity( num );
|
||||
}
|
||||
@ -129,14 +129,14 @@ inline void CUtlDict<T, I>::EnsureCapacity( int num )
|
||||
//-----------------------------------------------------------------------------
|
||||
// gets particular elements
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
inline T& CUtlDict<T, I>::Element( I i )
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline T& CUtlDict<T, I, COMPARE_TYPE>::Element( I i )
|
||||
{
|
||||
return m_Elements[i];
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
inline const T& CUtlDict<T, I>::Element( I i ) const
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline const T& CUtlDict<T, I, COMPARE_TYPE>::Element( I i ) const
|
||||
{
|
||||
return m_Elements[i];
|
||||
}
|
||||
@ -144,32 +144,32 @@ inline const T& CUtlDict<T, I>::Element( I i ) const
|
||||
//-----------------------------------------------------------------------------
|
||||
// gets element names
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
inline char *CUtlDict<T, I>::GetElementName( I i )
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline char *CUtlDict<T, I, COMPARE_TYPE>::GetElementName( I i )
|
||||
{
|
||||
return (char *)m_Elements.Key( i );
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
inline char const *CUtlDict<T, I>::GetElementName( I i ) const
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline char const *CUtlDict<T, I, COMPARE_TYPE>::GetElementName( I i ) const
|
||||
{
|
||||
return m_Elements.Key( i );
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
inline T& CUtlDict<T, I>::operator[]( I i )
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline T& CUtlDict<T, I, COMPARE_TYPE>::operator[]( I i )
|
||||
{
|
||||
return Element(i);
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
inline const T & CUtlDict<T, I>::operator[]( I i ) const
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline const T & CUtlDict<T, I, COMPARE_TYPE>::operator[]( I i ) const
|
||||
{
|
||||
return Element(i);
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
inline void CUtlDict<T, I>::SetElementName( I i, char const *pName )
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline void CUtlDict<T, I, COMPARE_TYPE>::SetElementName( I i, char const *pName )
|
||||
{
|
||||
MEM_ALLOC_CREDIT_CLASS();
|
||||
// TODO: This makes a copy of the old element
|
||||
@ -182,8 +182,8 @@ inline void CUtlDict<T, I>::SetElementName( I i, char const *pName )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Num elements
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
inline unsigned int CUtlDict<T, I>::Count() const
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline unsigned int CUtlDict<T, I, COMPARE_TYPE>::Count() const
|
||||
{
|
||||
return m_Elements.Count();
|
||||
}
|
||||
@ -192,8 +192,8 @@ inline unsigned int CUtlDict<T, I>::Count() const
|
||||
//-----------------------------------------------------------------------------
|
||||
// Checks if a node is valid and in the tree
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
inline bool CUtlDict<T, I>::IsValidIndex( I i ) const
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline bool CUtlDict<T, I, COMPARE_TYPE>::IsValidIndex( I i ) const
|
||||
{
|
||||
return m_Elements.IsValidIndex(i);
|
||||
}
|
||||
@ -202,8 +202,8 @@ inline bool CUtlDict<T, I>::IsValidIndex( I i ) const
|
||||
//-----------------------------------------------------------------------------
|
||||
// Invalid index
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
inline I CUtlDict<T, I>::InvalidIndex()
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
inline I CUtlDict<T, I, COMPARE_TYPE>::InvalidIndex()
|
||||
{
|
||||
return DictElementMap_t::InvalidIndex();
|
||||
}
|
||||
@ -212,8 +212,8 @@ inline I CUtlDict<T, I>::InvalidIndex()
|
||||
//-----------------------------------------------------------------------------
|
||||
// Delete a node from the tree
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
void CUtlDict<T, I>::RemoveAt(I elem)
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
void CUtlDict<T, I, COMPARE_TYPE>::RemoveAt(I elem)
|
||||
{
|
||||
free( (void *)m_Elements.Key( elem ) );
|
||||
m_Elements.RemoveAt(elem);
|
||||
@ -223,7 +223,8 @@ void CUtlDict<T, I>::RemoveAt(I elem)
|
||||
//-----------------------------------------------------------------------------
|
||||
// remove a node in the tree
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I> void CUtlDict<T, I>::Remove( const char *search )
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
void CUtlDict<T, I, COMPARE_TYPE>::Remove( const char *search )
|
||||
{
|
||||
I node = Find( search );
|
||||
if (node != InvalidIndex())
|
||||
@ -236,8 +237,8 @@ template <class T, class I> void CUtlDict<T, I>::Remove( const char *search )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Removes all nodes from the tree
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
void CUtlDict<T, I>::RemoveAll()
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
void CUtlDict<T, I, COMPARE_TYPE>::RemoveAll()
|
||||
{
|
||||
typename DictElementMap_t::IndexType_t index = m_Elements.FirstInorder();
|
||||
while ( index != m_Elements.InvalidIndex() )
|
||||
@ -249,15 +250,15 @@ void CUtlDict<T, I>::RemoveAll()
|
||||
m_Elements.RemoveAll();
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
void CUtlDict<T, I>::Purge()
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
void CUtlDict<T, I, COMPARE_TYPE>::Purge()
|
||||
{
|
||||
RemoveAll();
|
||||
}
|
||||
|
||||
|
||||
template <class T, class I>
|
||||
void CUtlDict<T, I>::PurgeAndDeleteElements()
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
void CUtlDict<T, I, COMPARE_TYPE>::PurgeAndDeleteElements()
|
||||
{
|
||||
// Delete all the elements.
|
||||
I index = m_Elements.FirstInorder();
|
||||
@ -275,15 +276,15 @@ void CUtlDict<T, I>::PurgeAndDeleteElements()
|
||||
//-----------------------------------------------------------------------------
|
||||
// inserts a node into the tree
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
I CUtlDict<T, I>::Insert( const char *pName, const T &element )
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
I CUtlDict<T, I, COMPARE_TYPE>::Insert( const char *pName, const T &element )
|
||||
{
|
||||
MEM_ALLOC_CREDIT_CLASS();
|
||||
return m_Elements.Insert( strdup( pName ), element );
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
I CUtlDict<T, I>::Insert( const char *pName )
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
I CUtlDict<T, I, COMPARE_TYPE>::Insert( const char *pName )
|
||||
{
|
||||
MEM_ALLOC_CREDIT_CLASS();
|
||||
return m_Elements.Insert( strdup( pName ) );
|
||||
@ -293,8 +294,8 @@ I CUtlDict<T, I>::Insert( const char *pName )
|
||||
//-----------------------------------------------------------------------------
|
||||
// finds a node in the tree
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
I CUtlDict<T, I>::Find( const char *pName ) const
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
I CUtlDict<T, I, COMPARE_TYPE>::Find( const char *pName ) const
|
||||
{
|
||||
MEM_ALLOC_CREDIT_CLASS();
|
||||
if ( pName )
|
||||
@ -307,14 +308,14 @@ I CUtlDict<T, I>::Find( const char *pName ) const
|
||||
//-----------------------------------------------------------------------------
|
||||
// Iteration methods
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class T, class I>
|
||||
I CUtlDict<T, I>::First() const
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
I CUtlDict<T, I, COMPARE_TYPE>::First() const
|
||||
{
|
||||
return m_Elements.FirstInorder();
|
||||
}
|
||||
|
||||
template <class T, class I>
|
||||
I CUtlDict<T, I>::Next( I i ) const
|
||||
template <class T, class I, int COMPARE_TYPE>
|
||||
I CUtlDict<T, I, COMPARE_TYPE>::Next( I i ) const
|
||||
{
|
||||
return m_Elements.NextInorder(i);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
//-------------------------------------
|
||||
|
||||
inline bool StringLessThan( const char * const &lhs, const char * const &rhs) { return ( strcmp( lhs, rhs) < 0 ); }
|
||||
inline bool CaselessStringLessThan( const char * const &lhs, const char * const &rhs ) { return ( stricmp( lhs, rhs) < 0 ); }
|
||||
inline bool CaselessStringLessThan( const char * const &lhs, const char * const &rhs ) { return ( V_stricmp_fast( lhs, rhs) < 0 ); }
|
||||
|
||||
|
||||
// Same as CaselessStringLessThan, but it ignores differences in / and \.
|
||||
@ -92,6 +92,33 @@ inline bool CaselessStringLessThanIgnoreSlashes( const char * const &lhs, const
|
||||
return false;
|
||||
}
|
||||
|
||||
class CDefStringLess
|
||||
{
|
||||
public:
|
||||
CDefStringLess() {}
|
||||
CDefStringLess( int i ) {}
|
||||
inline bool operator()( const char * const &lhs, const char * const &rhs ) const { return StringLessThan( lhs, rhs ); }
|
||||
inline bool operator!() const { return false; }
|
||||
};
|
||||
|
||||
class CDefCaselessStringLess
|
||||
{
|
||||
public:
|
||||
CDefCaselessStringLess() {}
|
||||
CDefCaselessStringLess( int i ) {}
|
||||
inline bool operator()( const char * const &lhs, const char * const &rhs ) const { return CaselessStringLessThan( lhs, rhs ); }
|
||||
inline bool operator!() const { return false; }
|
||||
};
|
||||
|
||||
class CDefCaselessStringLessIgnoreSlashes
|
||||
{
|
||||
public:
|
||||
CDefCaselessStringLessIgnoreSlashes() {}
|
||||
CDefCaselessStringLessIgnoreSlashes( int i ) {}
|
||||
inline bool operator()( const char * const &lhs, const char * const &rhs ) const { return CaselessStringLessThanIgnoreSlashes( lhs, rhs ); }
|
||||
inline bool operator!() const { return false; }
|
||||
};
|
||||
|
||||
//-------------------------------------
|
||||
// inline these two templates to stop multiple definitions of the same code
|
||||
template <> inline bool CDefOps<const char *>::LessFunc( const char * const &lhs, const char * const &rhs ) { return StringLessThan( lhs, rhs ); }
|
||||
@ -197,7 +224,7 @@ public:
|
||||
void SetLessFunc( const LessFunc_t &func );
|
||||
|
||||
// Allocation method
|
||||
I NewNode();
|
||||
I NewNode( bool bConstructElement );
|
||||
|
||||
// Insert method (inserts in order)
|
||||
I Insert( T const &insert );
|
||||
@ -276,7 +303,7 @@ protected:
|
||||
void RemoveRebalance(I i);
|
||||
|
||||
// Insertion, removal
|
||||
I InsertAt( I parent, bool leftchild );
|
||||
I InsertAt( I parent, bool leftchild, bool bConstructElement );
|
||||
|
||||
// copy constructors not allowed
|
||||
CUtlRBTree( CUtlRBTree<T, I, L, M> const &tree );
|
||||
@ -647,7 +674,7 @@ inline void CUtlRBTree<T, I, L, M>::SetColor( I i, typename CUtlRBTree<T, I, L,
|
||||
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
|
||||
#endif
|
||||
template < class T, class I, typename L, class M >
|
||||
I CUtlRBTree<T, I, L, M>::NewNode()
|
||||
I CUtlRBTree<T, I, L, M>::NewNode( bool bConstructElement )
|
||||
{
|
||||
I elem;
|
||||
|
||||
@ -686,6 +713,7 @@ I CUtlRBTree<T, I, L, M>::NewNode()
|
||||
node.m_Left = node.m_Right = node.m_Parent = InvalidIndex();
|
||||
#endif
|
||||
|
||||
if ( bConstructElement )
|
||||
Construct( &Element( elem ) );
|
||||
|
||||
return elem;
|
||||
@ -845,9 +873,9 @@ void CUtlRBTree<T, I, L, M>::InsertRebalance(I elem)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
template < class T, class I, typename L, class M >
|
||||
I CUtlRBTree<T, I, L, M>::InsertAt( I parent, bool leftchild )
|
||||
I CUtlRBTree<T, I, L, M>::InsertAt( I parent, bool leftchild, bool bConstructElement )
|
||||
{
|
||||
I i = NewNode();
|
||||
I i = NewNode( bConstructElement );
|
||||
LinkToParent( i, parent, leftchild );
|
||||
++m_NumElements;
|
||||
|
||||
@ -1475,8 +1503,8 @@ I CUtlRBTree<T, I, L, M>::Insert( T const &insert )
|
||||
I parent;
|
||||
bool leftchild;
|
||||
FindInsertionPosition( insert, parent, leftchild );
|
||||
I newNode = InsertAt( parent, leftchild );
|
||||
Element( newNode ) = insert;
|
||||
I newNode = InsertAt( parent, leftchild, false );
|
||||
CopyConstruct( &Element( newNode ), insert );
|
||||
return newNode;
|
||||
}
|
||||
|
||||
@ -1517,8 +1545,8 @@ I CUtlRBTree<T, I, L, M>::InsertIfNotFound( T const &insert )
|
||||
return InvalidIndex();
|
||||
}
|
||||
|
||||
I newNode = InsertAt( parent, leftchild );
|
||||
Element( newNode ) = insert;
|
||||
I newNode = InsertAt( parent, leftchild, false );
|
||||
CopyConstruct( &Element( newNode ), insert );
|
||||
return newNode;
|
||||
}
|
||||
|
||||
|
@ -1438,7 +1438,7 @@ void CKeyValues3Table::RemoveMember( KV3MemberId_t id )
|
||||
else
|
||||
{
|
||||
delete m_Members[ id ];
|
||||
delete m_Names[ id ];
|
||||
free( (void*)m_Names[ id ] );
|
||||
}
|
||||
|
||||
m_Hashes.Remove( id );
|
||||
@ -1466,7 +1466,7 @@ void CKeyValues3Table::RemoveAll( int nAllocSize )
|
||||
else
|
||||
{
|
||||
delete m_Members[i];
|
||||
delete m_Names[i];
|
||||
free( (void*)m_Names[i] );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1511,7 +1511,7 @@ void CKeyValues3Table::Purge( bool bClearingContext )
|
||||
else
|
||||
{
|
||||
delete m_Members[i];
|
||||
delete m_Names[i];
|
||||
free( (void*)m_Names[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user