Add extension methods for clearing netprop & datamaps cache (#1943)
This commit is contained in:
@@ -1600,3 +1600,26 @@ uint64_t CHalfLife2::GetServerSteamId64() const
|
||||
|
||||
return 1ULL;
|
||||
}
|
||||
|
||||
void CHalfLife2::RemoveDataTableCache(datamap_t *pMap)
|
||||
{
|
||||
if (pMap == nullptr)
|
||||
{
|
||||
m_Maps.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
m_Maps.removeIfExists(pMap);
|
||||
}
|
||||
|
||||
bool CHalfLife2::RemoveSendPropCache(const char *classname)
|
||||
{
|
||||
if (classname == nullptr)
|
||||
{
|
||||
m_Classes.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_Classes.remove(classname);
|
||||
}
|
||||
|
||||
|
||||
@@ -261,6 +261,8 @@ public: //IGameHelpers
|
||||
string_t AllocPooledString(const char *pszValue);
|
||||
bool GetServerSteam3Id(char *pszOut, size_t len) const override;
|
||||
uint64_t GetServerSteamId64() const override;
|
||||
void RemoveDataTableCache(datamap_t *pMap = nullptr);
|
||||
bool RemoveSendPropCache(const char *classname = nullptr);
|
||||
public:
|
||||
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
|
||||
void ProcessFakeCliCmdQueue();
|
||||
|
||||
+16
-1
@@ -40,7 +40,7 @@
|
||||
*/
|
||||
|
||||
#define SMINTERFACE_GAMEHELPERS_NAME "IGameHelpers"
|
||||
#define SMINTERFACE_GAMEHELPERS_VERSION 12
|
||||
#define SMINTERFACE_GAMEHELPERS_VERSION 13
|
||||
|
||||
class CBaseEntity;
|
||||
class CBaseHandle;
|
||||
@@ -358,6 +358,21 @@ namespace SourceMod
|
||||
* @return ServerClass pointer on success, nullptr on failure.
|
||||
*/
|
||||
virtual ServerClass *FindEntityServerClass(CBaseEntity *pEntity) = 0;
|
||||
|
||||
/**
|
||||
* @brief Clears all, or removes a single datamap from the DataTable cache.
|
||||
*
|
||||
* @param pMap NULL or datamap_t pointer.
|
||||
*/
|
||||
virtual void RemoveDataTableCache(datamap_t *pMap = nullptr) =0;
|
||||
|
||||
/**
|
||||
* @brief Clears all, or removes a single class from the SendProp cache.
|
||||
*
|
||||
* @param classname NULL pointer or entity class name.
|
||||
* @return True if cache was found and removed.
|
||||
*/
|
||||
virtual bool RemoveSendPropCache(const char *classname = nullptr) =0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user