1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-20 13:54:14 +01:00

Obsolete KVLoadFromFile

Current implementation isn't used anywhere in the s2 provider and due to the removal of MemAllocScratch & MemFreeScratch I guess this could be obsoleted
This commit is contained in:
GAMMACASE 2023-09-08 18:20:22 +03:00 committed by Nicholas Hastings
parent ee9243c82f
commit 3b5d72df1d
2 changed files with 0 additions and 32 deletions

View File

@ -354,36 +354,6 @@ void LocalCommand_Meta(const CCommandContext &, const CCommand& args)
}
}
bool Source2Provider::KVLoadFromFile(KeyValues* kv, IFileSystem* filesystem, const char* resourceName, const char* pathID)
{
Assert(filesystem);
#ifdef _MSC_VER
Assert(_heapchk() == _HEAPOK);
#endif
FileHandle_t f = filesystem->Open(resourceName, "rb", pathID);
if (!f)
return false;
// load file into a null-terminated buffer
int fileSize = filesystem->Size(f);
char* buffer = (char*)MemAllocScratch(fileSize + 1);
Assert(buffer);
filesystem->Read(buffer, fileSize, f); // read into local buffer
buffer[fileSize] = 0; // null terminate file as EOF
filesystem->Close(f); // close file after reading
bool retOK = kv->LoadFromBuffer(resourceName, buffer, filesystem);
MemFreeScratch();
return retOK;
}
void Source2Provider::Hook_StartupServer_Post(const GameSessionConfiguration_t &config, ISource2WorldSession *, const char *)
{
static bool bGameServerHooked = false;

View File

@ -72,8 +72,6 @@ public:
CUtlVector<INetworkGameClient *> *Hook_StartChangeLevel(const char*, const char*, void*);
void Hook_SwitchToLoop(const char *pszLoopName, KeyValues *pKV, uint32 nId, const char *pszUnk, bool bUnk);
void Hook_ClientCommand(CPlayerSlot nSlot, const CCommand& args);
private:
bool KVLoadFromFile(KeyValues *kv, IFileSystem *filesystem, const char *resourceName, const char *pathID);
private:
IFileSystem* baseFs = nullptr;
std::string sLastMap;