mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-06 18:08:36 +00:00
Add extension methods for clearing netprop & datamaps cache (#1943)
Some checks failed
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang, clang++, ubuntu-latest, linux) (push) Has been cancelled
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang-8, clang++-8, ubuntu-20.04, linux) (push) Has been cancelled
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (msvc, windows-latest, win) (push) Has been cancelled
hl2sdk-mock tests / mock (push) Has been cancelled
Some checks failed
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang, clang++, ubuntu-latest, linux) (push) Has been cancelled
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang-8, clang++-8, ubuntu-20.04, linux) (push) Has been cancelled
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (msvc, windows-latest, win) (push) Has been cancelled
hl2sdk-mock tests / mock (push) Has been cancelled
This commit is contained in:
parent
30da01763d
commit
a35e22c76e
@ -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();
|
||||
|
||||
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user