diff options
| author | oy <Tom_Adams@web.de> | 2011-03-20 11:15:24 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-03-20 11:15:24 +0100 |
| commit | 79aa9d640e5b258e6698d5d86adf190e02dcf866 (patch) | |
| tree | 18e5009fe3adf888a8c261569c2ebc2b7e4f9e1f | |
| parent | 3a7d93e182a518e9cc89aec72e9975bfae762ebb (diff) | |
| download | zcatch-79aa9d640e5b258e6698d5d86adf190e02dcf866.tar.gz zcatch-79aa9d640e5b258e6698d5d86adf190e02dcf866.zip | |
fixed that server browser shows the correct country flag
| -rw-r--r-- | src/engine/client.h | 1 | ||||
| -rw-r--r-- | src/engine/client/client.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/gameclient.cpp | 22 | ||||
| -rw-r--r-- | src/game/client/gameclient.h | 1 |
4 files changed, 15 insertions, 11 deletions
diff --git a/src/engine/client.h b/src/engine/client.h index 31b6f794..870c355d 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -159,6 +159,7 @@ public: virtual int OnSnapInput(int *pData) = 0; virtual const char *GetItemName(int Type) = 0; + virtual int GetCountryIndex(int Code) = 0; virtual const char *Version() = 0; virtual const char *NetVersion() = 0; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 7277cecd..723b8791 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1119,7 +1119,7 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket) { str_copy(Info.m_aPlayers[i].m_aName, Up.GetString(CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES), sizeof(Info.m_aPlayers[i].m_aName)); str_copy(Info.m_aPlayers[i].m_aClan, Up.GetString(CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES), sizeof(Info.m_aPlayers[i].m_aClan)); - Info.m_aPlayers[i].m_Country = str_toint(Up.GetString()); + Info.m_aPlayers[i].m_Country = GameClient()->GetCountryIndex(str_toint(Up.GetString())); Info.m_aPlayers[i].m_Score = str_toint(Up.GetString()); } diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 15786110..d8f18421 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -88,6 +88,17 @@ void CGameClient::CStack::Add(class CComponent *pComponent) { m_paComponents[m_N const char *CGameClient::Version() { return GAME_VERSION; } const char *CGameClient::NetVersion() { return GAME_NETVERSION; } const char *CGameClient::GetItemName(int Type) { return m_NetObjHandler.GetObjName(Type); } +int CGameClient::GetCountryIndex(int Code) +{ + int Index = g_GameClient.m_pCountryFlags->Find(Code); + if(Index < 0) + { + Index = g_GameClient.m_pCountryFlags->Find(-1); + if(Index < 0) + Index = 0; + } + return Index; +} void CGameClient::OnConsoleInit() { @@ -695,21 +706,12 @@ void CGameClient::OnNewSnapshot() int ClientID = Item.m_ID; IntsToStr(&pInfo->m_Name0, 4, m_aClients[ClientID].m_aName); IntsToStr(&pInfo->m_Clan0, 3, m_aClients[ClientID].m_aClan); - m_aClients[ClientID].m_Country = pInfo->m_Country; + m_aClients[ClientID].m_Country = GetCountryIndex(pInfo->m_Country); IntsToStr(&pInfo->m_Skin0, 6, m_aClients[ClientID].m_aSkinName); m_aClients[ClientID].m_UseCustomColor = pInfo->m_UseCustomColor; m_aClients[ClientID].m_ColorBody = pInfo->m_ColorBody; m_aClients[ClientID].m_ColorFeet = pInfo->m_ColorFeet; - - // find country flag - m_aClients[ClientID].m_Country = g_GameClient.m_pCountryFlags->Find(m_aClients[ClientID].m_Country); - if(m_aClients[ClientID].m_Country < 0) - { - m_aClients[ClientID].m_Country = g_GameClient.m_pCountryFlags->Find(-1); - if(m_aClients[ClientID].m_Country < 0) - m_aClients[ClientID].m_Country = 0; - } // prepare the info if(m_aClients[ClientID].m_aSkinName[0] == 'x' || m_aClients[ClientID].m_aSkinName[1] == '_') diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 26c839a3..0c899805 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -203,6 +203,7 @@ public: virtual void OnStartGame(); virtual const char *GetItemName(int Type); + virtual int GetCountryIndex(int Code); virtual const char *Version(); virtual const char *NetVersion(); |