Fix language file being loaded twice when starting

Ignore language file config variable being set initially in the conchain (i.e. when `GlobalTime` still returns zero) and check whether the value changed before reloading the language.
This commit is contained in:
Robert Müller 2024-06-01 21:30:16 +02:00
parent 64fec2cd37
commit f762e2364f

View file

@ -2414,9 +2414,13 @@ void CGameClient::ConKill(IConsole::IResult *pResult, void *pUserData)
void CGameClient::ConchainLanguageUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
{
CGameClient *pThis = static_cast<CGameClient *>(pUserData);
const bool Changed = pThis->Client()->GlobalTime() && pResult->NumArguments() && str_comp(pResult->GetString(0), g_Config.m_ClLanguagefile) != 0;
pfnCallback(pResult, pCallbackUserData);
if(pResult->NumArguments())
((CGameClient *)pUserData)->OnLanguageChange();
if(Changed)
{
pThis->OnLanguageChange();
}
}
void CGameClient::ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)