mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Avoid heap memory allocation and a level of indirection. This allows the compiler to optimize the program even more. No logic has been changed in this patch.
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include "core/stdafx.h"
|
|
#include "tier1/utlvector.h"
|
|
#include "localize/localize.h"
|
|
#include "pluginsystem/modsystem.h"
|
|
|
|
bool Localize_LoadLocalizationFileLists(CLocalize* thisptr)
|
|
{
|
|
CLocalize__LoadLocalizationFileLists(thisptr);
|
|
|
|
const CUtlVector<CModSystem::ModInstance_t*>&
|
|
modList = ModSystem()->GetModList();
|
|
|
|
FOR_EACH_VEC(modList, i)
|
|
{
|
|
const CModSystem::ModInstance_t* mod =
|
|
modList.Element(i);
|
|
|
|
if (!mod->IsEnabled())
|
|
continue;
|
|
|
|
FOR_EACH_VEC(mod->m_LocalizationFiles, j)
|
|
{
|
|
const char* localizationFile = mod->m_LocalizationFiles.Element(j).Get();
|
|
|
|
if (!CLocalize__AddFile(thisptr, localizationFile, "PLATFORM"))
|
|
Warning(eDLL_T::ENGINE, "Failed to add localization file '%s'\n", localizationFile);
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool Localize_IsLanguageSupported(const char* pLocaleName)
|
|
{
|
|
for (int i = 0; i < SDK_ARRAYSIZE(g_LanguageNames); ++i)
|
|
{
|
|
if (strcmp(pLocaleName, g_LanguageNames[i]) == NULL)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void VLocalize::Detour(const bool bAttach) const
|
|
{
|
|
DetourSetup(&CLocalize__LoadLocalizationFileLists, &Localize_LoadLocalizationFileLists, bAttach);
|
|
}
|