mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24: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;
|
||||
int m_NumFound;
|
||||
|
||||
CFriendItem() {}
|
||||
CFriendItem(const CFriendInfo *pFriendInfo) :
|
||||
m_pFriendInfo(pFriendInfo), m_NumFound(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator<(const CFriendItem &Other) const
|
||||
{
|
||||
if(m_NumFound && !Other.m_NumFound)
|
||||
|
|
|
@ -1250,12 +1250,7 @@ void CMenus::FriendlistOnUpdate()
|
|||
{
|
||||
m_lFriends.clear();
|
||||
for(int i = 0; i < m_pClient->Friends()->NumFriends(); ++i)
|
||||
{
|
||||
CFriendItem Item;
|
||||
Item.m_pFriendInfo = m_pClient->Friends()->GetFriend(i);
|
||||
Item.m_NumFound = 0;
|
||||
m_lFriends.push_back(Item);
|
||||
}
|
||||
m_lFriends.emplace_back(m_pClient->Friends()->GetFriend(i));
|
||||
std::sort(m_lFriends.begin(), m_lFriends.end());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue