From 01fe5d997b51f1cfd154eeda4e608d0653087ccd Mon Sep 17 00:00:00 2001 From: xen Date: Sun, 10 Mar 2024 18:25:40 +0200 Subject: [PATCH] Add CEntityKeyValues IO accessors (#216) --- entity2/entitykeyvalues.cpp | 8 ++++++++ public/entity2/entitykeyvalues.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/entity2/entitykeyvalues.cpp b/entity2/entitykeyvalues.cpp index 7ed03150..e21fac3c 100644 --- a/entity2/entitykeyvalues.cpp +++ b/entity2/entitykeyvalues.cpp @@ -187,6 +187,14 @@ void CEntityKeyValues::AddConnectionDesc( desc->m_nTimesToFire = nTimesToFire; } +void CEntityKeyValues::RemoveConnectionDesc( int nDesc ) +{ + if (m_nQueuedForSpawnCount > 0) + return; + + m_connectionDescs.Remove( nDesc ); +} + void CEntityKeyValues::CopyFrom( const CEntityKeyValues* pSrc, bool bRemoveAllKeys, bool bSkipEHandles ) { if ( bRemoveAllKeys ) diff --git a/public/entity2/entitykeyvalues.h b/public/entity2/entitykeyvalues.h index e040665f..08e84902 100644 --- a/public/entity2/entitykeyvalues.h +++ b/public/entity2/entitykeyvalues.h @@ -105,6 +105,11 @@ public: float flDelay, int32 nTimesToFire ); + void RemoveConnectionDesc( int nDesc ); + + EntityIOConnectionDescFat_t* GetConnectionDesc( int nDesc ) { return &m_connectionDescs[nDesc]; } + int GetNumConnectionDescs() const { return m_connectionDescs.Count(); } + void CopyFrom( const CEntityKeyValues* pSrc, bool bRemoveAllKeys = false, bool bSkipEHandles = false ); void RemoveKeyValue( const EntityKeyId_t &id ); void RemoveAllKeys();