Skip to content

Commit 2752fac

Browse files
committed
Add friends sorting in the lobby interface
1 parent 8004769 commit 2752fac

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,8 @@ void PopulateLobbyPlayerListbox(void)
762762
NGMP_OnlineServices_RoomsInterface* pRoomsInterface = NGMP_OnlineServicesManager::GetInterface<NGMP_OnlineServices_RoomsInterface>();
763763
NGMP_OnlineServices_StatsInterface* pStatsInterface = NGMP_OnlineServicesManager::GetInterface<NGMP_OnlineServices_StatsInterface>();
764764
NGMP_OnlineServices_AuthInterface* pAuthInterface = NGMP_OnlineServicesManager::GetInterface<NGMP_OnlineServices_AuthInterface>();
765-
if (pRoomsInterface != nullptr && pStatsInterface != nullptr && pAuthInterface != nullptr)
765+
NGMP_OnlineServices_SocialInterface* pSocialInterface = NGMP_OnlineServicesManager::GetInterface<NGMP_OnlineServices_SocialInterface>();
766+
if (pRoomsInterface != nullptr && pStatsInterface != nullptr && pAuthInterface != nullptr && pSocialInterface != nullptr)
766767
{
767768
int64_t localUserID = pAuthInterface->GetUserID();
768769

@@ -839,10 +840,17 @@ void PopulateLobbyPlayerListbox(void)
839840
});
840841

841842
// Admin/staff first
842-
std::stable_partition(sorted.begin(), sorted.end(),
843+
auto adminSorted = std::stable_partition(sorted.begin(), sorted.end(),
843844
[](const auto& x) {
844845
return x.m_bIsAdmin;
845846
});
847+
848+
// friends next, after admin and if not admin
849+
std::stable_partition(adminSorted, sorted.end(),
850+
[=](const auto& x)
851+
{
852+
return pSocialInterface->IsUserFriend(x.user_id);
853+
});
846854
}
847855

848856

0 commit comments

Comments
 (0)