mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Browser: make the sliding window of join friend button IDs global to all friend lists
This commit is contained in:
parent
513249c24b
commit
ff22c4106a
|
@ -1402,6 +1402,9 @@ void CMenus::RenderServerbrowserFriendTab(CUIRect View)
|
|||
}
|
||||
|
||||
// show lists
|
||||
// only ~10 buttons will be displayed at once, a sliding window of 20 buttons ought to be enough
|
||||
static CButtonContainer s_FriendJoinButtons[20];
|
||||
int ButtonId = 0;
|
||||
for(int i = 0; i < NUM_FRIEND_TYPES; ++i)
|
||||
{
|
||||
CUIRect Header;
|
||||
|
@ -1410,8 +1413,7 @@ void CMenus::RenderServerbrowserFriendTab(CUIRect View)
|
|||
if(s_ListExtended[i])
|
||||
{
|
||||
// entries
|
||||
static CButtonContainer s_JoinButtons[20]; // max of ~10 buttons displayed at once
|
||||
for(int f = 0; f < m_lFriendList[i].size(); ++f)
|
||||
for(int f = 0; f < m_lFriendList[i].size(); ++f, ++ButtonId)
|
||||
{
|
||||
View.HSplitTop(20.0f + ms_ListheaderHeight, &Rect, &View);
|
||||
RenderTools()->DrawUIRect(&Rect, vec4(0.5f, 0.5f, 0.5f, 0.5f), CUI::CORNER_ALL, 5.0f);
|
||||
|
@ -1455,7 +1457,7 @@ void CMenus::RenderServerbrowserFriendTab(CUIRect View)
|
|||
if(m_lFriendList[i][f].m_pServerInfo)
|
||||
{
|
||||
Button.Margin((Button.h - ms_ListheaderHeight + 2.0f) / 2, &Button);
|
||||
if(DoButton_Menu(&(s_JoinButtons[f%20]), Localize("Join", "Join a server"), 0, &Button) )
|
||||
if(DoButton_Menu(&(s_FriendJoinButtons[ButtonId%20]), Localize("Join", "Join a server"), 0, &Button) )
|
||||
{
|
||||
str_copy(g_Config.m_UiServerAddress, m_lFriendList[i][f].m_pServerInfo->m_aAddress, sizeof(g_Config.m_UiServerAddress));
|
||||
Client()->Connect(g_Config.m_UiServerAddress);
|
||||
|
|
Loading…
Reference in a new issue