From 637f7fd736a4426ae699f2d490c98793c4267e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 19 May 2023 15:14:46 +0200 Subject: [PATCH] Reduce duplicate UI spacing code --- src/game/client/components/menus_browser.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 2ef5f4815..fd36dbd8b 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -1377,25 +1377,19 @@ void CMenus::RenderServerbrowserFriends(CUIRect View) // entries if(s_aListExtended[FriendType]) { - // space - { - CUIRect Space; - List.HSplitTop(SpacingH, &Space, &List); - s_ScrollRegion.AddRect(Space); - } - for(size_t FriendIndex = 0; FriendIndex < m_avFriends[FriendType].size(); ++FriendIndex) { - CUIRect Rect; - const auto &Friend = m_avFriends[FriendType][FriendIndex]; - List.HSplitTop(10.0f + 10.0f + 2 * 2.0f + 1.0f + (Friend.ServerInfo() == nullptr ? 0.0f : 10.0f), &Rect, &List); - s_ScrollRegion.AddRect(Rect); - if(FriendIndex < m_avFriends[FriendType].size() - 1) + // space { CUIRect Space; List.HSplitTop(SpacingH, &Space, &List); s_ScrollRegion.AddRect(Space); } + + CUIRect Rect; + const auto &Friend = m_avFriends[FriendType][FriendIndex]; + List.HSplitTop(10.0f + 10.0f + 2 * 2.0f + 1.0f + (Friend.ServerInfo() == nullptr ? 0.0f : 10.0f), &Rect, &List); + s_ScrollRegion.AddRect(Rect); if(s_ScrollRegion.IsRectClipped(Rect)) continue;