1.1 --- a/core/PlayerManager.cpp Sun Aug 19 13:55:33 2007 +0000
1.2 +++ b/core/PlayerManager.cpp Sun Aug 19 15:02:20 2007 +0000
1.3 @@ -42,9 +42,7 @@
1.4 #include <iclient.h>
1.5 #include "TimerSys.h"
1.6 #include "Translator.h"
1.7 -#include "ConVarManager.h"
1.8 #include "Logger.h"
1.9 -#include "HalfLife2.h"
1.10
1.11 PlayerManager g_Players;
1.12 bool g_OnMapStarted = false;
1.13 @@ -500,14 +498,15 @@
1.14 pPlayer->m_Info = playerinfo->GetPlayerInfo(pEntity);
1.15 }
1.16
1.17 - /* Query the client's language */
1.18 + /* Get the client's language */
1.19 if (m_QueryLang)
1.20 {
1.21 - if (!pPlayer->IsFakeClient() && !g_IsOriginalEngine)
1.22 + const char *name;
1.23 + if (!pPlayer->IsFakeClient() && (name=engine->GetClientConVarValue(client, "cl_language")))
1.24 {
1.25 - pPlayer->m_LangCookie = g_ConVarManager.QueryClientConVar(pPlayer->GetEdict(), "cl_language", NULL, 0);
1.26 + unsigned int langid;
1.27 + pPlayer->m_LangId = (g_Translator.GetLanguageByName(name, &langid)) ? langid : g_Translator.GetServerLanguage();
1.28 } else {
1.29 - /* Skip the query if this is a bot or if we cant query cvars*/
1.30 pPlayer->m_LangId = g_Translator.GetServerLanguage();
1.31 }
1.32 }
1.33 @@ -846,28 +845,6 @@
1.34 }
1.35 }
1.36
1.37 -void PlayerManager::HandleLangQuery(int userid, const char *value, QueryCvarCookie_t cookie)
1.38 -{
1.39 - int id = GetClientOfUserId(userid);
1.40 - if (id == 0)
1.41 - {
1.42 - return;
1.43 - }
1.44 -
1.45 - CPlayer *pl = GetPlayerByIndex(id);
1.46 -
1.47 - unsigned int langid;
1.48 - if (pl->m_LangCookie == cookie)
1.49 - {
1.50 - if (value[0] != '\0' && g_Translator.GetLanguageByName(value, &langid))
1.51 - {
1.52 - pl->m_LangId = langid;
1.53 - } else {
1.54 - pl->m_LangId = g_Translator.GetServerLanguage();
1.55 - }
1.56 - }
1.57 -}
1.58 -
1.59 /*******************
1.60 *** PLAYER CODE ***
1.61 *******************/
1.62 @@ -884,7 +861,6 @@
1.63 m_bAdminCheckSignalled = false;
1.64 m_LastPassword.clear();
1.65 m_LangId = LANGUAGE_ENGLISH;
1.66 - m_LangCookie = 0;
1.67 }
1.68
1.69 void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
1.70 @@ -895,7 +871,6 @@
1.71 m_pEdict = pEntity;
1.72 m_iIndex = engine->IndexOfEdict(pEntity);
1.73 m_LangId = g_Translator.GetServerLanguage();
1.74 - m_LangCookie = 0;
1.75
1.76 char ip2[24], *ptr;
1.77 strncopy(ip2, ip, sizeof(ip2));