about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-03-20 11:15:24 +0100
committeroy <Tom_Adams@web.de>2011-03-20 11:15:24 +0100
commit79aa9d640e5b258e6698d5d86adf190e02dcf866 (patch)
tree18e5009fe3adf888a8c261569c2ebc2b7e4f9e1f /src/game
parent3a7d93e182a518e9cc89aec72e9975bfae762ebb (diff)
downloadzcatch-79aa9d640e5b258e6698d5d86adf190e02dcf866.tar.gz
zcatch-79aa9d640e5b258e6698d5d86adf190e02dcf866.zip
fixed that server browser shows the correct country flag
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/gameclient.cpp22
-rw-r--r--src/game/client/gameclient.h1
2 files changed, 13 insertions, 10 deletions
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();