mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Use emplace_back for CFriendItem
This commit is contained in:
parent
476af1286d
commit
de1de5e7bd
|
@ -448,6 +448,12 @@ protected:
|
||||||
const CFriendInfo *m_pFriendInfo;
|
const CFriendInfo *m_pFriendInfo;
|
||||||
int m_NumFound;
|
int m_NumFound;
|
||||||
|
|
||||||
|
CFriendItem() {}
|
||||||
|
CFriendItem(const CFriendInfo *pFriendInfo) :
|
||||||
|
m_pFriendInfo(pFriendInfo), m_NumFound(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
bool operator<(const CFriendItem &Other) const
|
bool operator<(const CFriendItem &Other) const
|
||||||
{
|
{
|
||||||
if(m_NumFound && !Other.m_NumFound)
|
if(m_NumFound && !Other.m_NumFound)
|
||||||
|
|
|
@ -1250,12 +1250,7 @@ void CMenus::FriendlistOnUpdate()
|
||||||
{
|
{
|
||||||
m_lFriends.clear();
|
m_lFriends.clear();
|
||||||
for(int i = 0; i < m_pClient->Friends()->NumFriends(); ++i)
|
for(int i = 0; i < m_pClient->Friends()->NumFriends(); ++i)
|
||||||
{
|
m_lFriends.emplace_back(m_pClient->Friends()->GetFriend(i));
|
||||||
CFriendItem Item;
|
|
||||||
Item.m_pFriendInfo = m_pClient->Friends()->GetFriend(i);
|
|
||||||
Item.m_NumFound = 0;
|
|
||||||
m_lFriends.push_back(Item);
|
|
||||||
}
|
|
||||||
std::sort(m_lFriends.begin(), m_lFriends.end());
|
std::sort(m_lFriends.begin(), m_lFriends.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue