about summary refs log tree commit diff
path: root/src/game/client/gameclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client/gameclient.cpp')
-rw-r--r--src/game/client/gameclient.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp
index 9f0898fc..21180b40 100644
--- a/src/game/client/gameclient.cpp
+++ b/src/game/client/gameclient.cpp
@@ -2,6 +2,7 @@
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
 #include <engine/editor.h>
 #include <engine/engine.h>
+#include <engine/friends.h>
 #include <engine/graphics.h>
 #include <engine/textrender.h>
 #include <engine/demo.h>
@@ -115,6 +116,7 @@ void CGameClient::OnConsoleInit()
 	m_pDemoRecorder = Kernel()->RequestInterface<IDemoRecorder>();
 	m_pServerBrowser = Kernel()->RequestInterface<IServerBrowser>();
 	m_pEditor = Kernel()->RequestInterface<IEditor>();
+	m_pFriends = Kernel()->RequestInterface<IFriends>();
 	
 	// setup pointers
 	m_pBinds = &::gs_Binds;
@@ -834,6 +836,15 @@ void CGameClient::OnNewSnapshot()
 			m_aClients[i].Reset();
 	}
 
+	// update friend state
+	for(int i = 0; i < MAX_CLIENTS; ++i)
+	{
+		if(i == m_Snap.m_LocalClientID || !m_Snap.m_paPlayerInfos[i] || !Friends()->IsFriend(m_aClients[i].m_aName, m_aClients[i].m_aClan))
+			m_aClients[i].m_Friend = false;
+		else
+			m_aClients[i].m_Friend = true;
+	}
+
 	// sort player infos by score
 	mem_copy(m_Snap.m_paInfoByScore, m_Snap.m_paPlayerInfos, sizeof(m_Snap.m_paInfoByScore));
 	for(int k = 0; k < MAX_CLIENTS-1; k++) // ffs, bubblesort