MCPcopy Create free account
hub / github.com/ddnet/ddnet / GetFriendState

Method GetFriendState

src/engine/client/friends.cpp:68–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68int CFriends::GetFriendState(const char *pName, const char *pClan) const
69{
70 int Result = FRIEND_NO;
71 unsigned NameHash = str_quickhash(pName);
72 unsigned ClanHash = str_quickhash(pClan);
73 for(int i = 0; i < m_NumFriends; ++i)
74 {
75 if((g_Config.m_ClFriendsIgnoreClan && m_aFriends[i].m_aName[0]) || (m_aFriends[i].m_ClanHash == ClanHash && !str_comp(m_aFriends[i].m_aClan, pClan)))
76 {
77 if(m_aFriends[i].m_aName[0] == 0)
78 Result = FRIEND_CLAN;
79 else if(m_aFriends[i].m_NameHash == NameHash && !str_comp(m_aFriends[i].m_aName, pName))
80 {
81 Result = FRIEND_PLAYER;
82 break;
83 }
84 }
85 }
86 return Result;
87}
88
89bool CFriends::IsFriend(const char *pName, const char *pClan, bool PlayersOnly) const
90{

Callers 1

UpdateServerFriendsMethod · 0.80

Calls 2

str_quickhashFunction · 0.85
str_compFunction · 0.85

Tested by

no test coverage detected