diff options
| author | oy <Tom_Adams@web.de> | 2011-03-23 13:06:35 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-03-23 13:06:35 +0100 |
| commit | ae325c873f64603f3957b3ded623a67088752ba8 (patch) | |
| tree | 47f5abde2090975fc491503d0ecd5386da53830c /src/game/client/gameclient.cpp | |
| parent | b64db75a6b5e6a08c356278ab73d29707579844c (diff) | |
| download | zcatch-ae325c873f64603f3957b3ded623a67088752ba8.tar.gz zcatch-ae325c873f64603f3957b3ded623a67088752ba8.zip | |
added friends feature. Closes #24
Diffstat (limited to 'src/game/client/gameclient.cpp')
| -rw-r--r-- | src/game/client/gameclient.cpp | 11 |
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 |