Expose cache-clearing methods to extensions

This commit is contained in:
sirdigbot 2023-03-31 11:57:06 +11:00
parent c68715440f
commit 0aaf89da22
3 changed files with 28 additions and 1 deletions

View File

@ -1592,3 +1592,13 @@ uint64_t CHalfLife2::GetServerSteamId64() const
return 1ULL; return 1ULL;
} }
void CHalfLife2::RemoveDataTableCache(datamap_t *pMap)
{
this->ClearDataTableCache(pMap);
}
bool CHalfLife2::RemoveSendPropCache(const char *classname)
{
return this->ClearSendPropCache(classname);
}

View File

@ -258,6 +258,8 @@ public: //IGameHelpers
string_t AllocPooledString(const char *pszValue); string_t AllocPooledString(const char *pszValue);
bool GetServerSteam3Id(char *pszOut, size_t len) const override; bool GetServerSteam3Id(char *pszOut, size_t len) const override;
uint64_t GetServerSteamId64() const override; uint64_t GetServerSteamId64() const override;
void RemoveDataTableCache(datamap_t *pMap);
bool RemoveSendPropCache(const char *classname);
public: public:
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd); void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
void ProcessFakeCliCmdQueue(); void ProcessFakeCliCmdQueue();

View File

@ -40,7 +40,7 @@
*/ */
#define SMINTERFACE_GAMEHELPERS_NAME "IGameHelpers" #define SMINTERFACE_GAMEHELPERS_NAME "IGameHelpers"
#define SMINTERFACE_GAMEHELPERS_VERSION 11 #define SMINTERFACE_GAMEHELPERS_VERSION 12
class CBaseEntity; class CBaseEntity;
class CBaseHandle; class CBaseHandle;
@ -351,6 +351,21 @@ namespace SourceMod
* @return 64-bit server Steam id. * @return 64-bit server Steam id.
*/ */
virtual uint64_t GetServerSteamId64() const =0; virtual uint64_t GetServerSteamId64() const =0;
/**
* @brief Removes a datamap from the DataTable cache.
*
* @param pMap datamap_t pointer.
*/
virtual void RemoveDataTableCache(datamap_t *pMap) =0;
/**
* @brief Removes a class from the SendProp cache.
*
* @param classname Entity class name.
* @return True if cache was found and removed.
*/
virtual bool RemoveSendPropCache(const char *classname) =0;
}; };
} }