@@ -229,7 +229,7 @@ int CMenus::DoButton_MenuTab(CButtonContainer *pButtonContainer, const char *pTe
229229 }
230230 }
231231
232- if (pCommunityIcon)
232+ if (pCommunityIcon && g_Config. m_ClPreferIconButtons )
233233 {
234234 CUIRect CommunityIcon;
235235 Rect.Margin (2 .0f , &CommunityIcon);
@@ -662,6 +662,31 @@ void CMenus::RenderMenubar(CUIRect Box, IClient::EClientState ClientState)
662662 NewPage = PAGE_FAVORITES;
663663 }
664664 GameClient ()->m_Tooltips .DoToolTip (&s_FavoritesButton, &Button, Localize (" Favorites" ));
665+
666+ size_t FavoriteCommunityIndex = 0 ;
667+ static CButtonContainer s_aFavoriteCommunityButtons[5 ];
668+ static_assert (std::size (s_aFavoriteCommunityButtons) == (size_t )PAGE_FAVORITE_COMMUNITY_5 - PAGE_FAVORITE_COMMUNITY_1 + 1 );
669+ static_assert (std::size (s_aFavoriteCommunityButtons) == (size_t )BIT_TAB_FAVORITE_COMMUNITY_5 - BIT_TAB_FAVORITE_COMMUNITY_1 + 1 );
670+ static_assert (std::size (s_aFavoriteCommunityButtons) == (size_t )IServerBrowser::TYPE_FAVORITE_COMMUNITY_5 - IServerBrowser::TYPE_FAVORITE_COMMUNITY_1 + 1 );
671+ for (const CCommunity *pCommunity : ServerBrowser ()->FavoriteCommunities ())
672+ {
673+ if (Box.w < BrowserButtonWidth)
674+ break ;
675+ Box.VSplitLeft (BrowserButtonWidth, &Button, &Box);
676+ const int Page = PAGE_FAVORITE_COMMUNITY_1 + FavoriteCommunityIndex;
677+ if (DoButton_MenuTab (&s_aFavoriteCommunityButtons[FavoriteCommunityIndex], FONT_ICON_ELLIPSIS, ActivePage == Page, &Button, IGraphics::CORNER_T, &m_aAnimatorsBigPage[BIT_TAB_FAVORITE_COMMUNITY_1 + FavoriteCommunityIndex], nullptr , nullptr , nullptr , 10 .0f , FindCommunityIcon (pCommunity->Id ())))
678+ {
679+ NewPage = Page;
680+ }
681+ GameClient ()->m_Tooltips .DoToolTip (&s_aFavoriteCommunityButtons[FavoriteCommunityIndex], &Button, pCommunity->Name ());
682+
683+ ++FavoriteCommunityIndex;
684+ if (FavoriteCommunityIndex >= std::size (s_aFavoriteCommunityButtons))
685+ break ;
686+ }
687+
688+ TextRender ()->SetRenderFlags (0 );
689+ TextRender ()->SetFontPreset (EFontPreset::DEFAULT_FONT);
665690 }
666691 else
667692 {
@@ -688,8 +713,42 @@ void CMenus::RenderMenubar(CUIRect Box, IClient::EClientState ClientState)
688713 {
689714 NewPage = PAGE_FAVORITES;
690715 }
691- TextRender ()->SetFontPreset (EFontPreset::ICON_FONT);
692- TextRender ()->SetRenderFlags (ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
716+
717+ size_t FavoriteCommunityIndex = 0 ;
718+ static CButtonContainer s_aFavoriteCommunityButtons[5 ];
719+ static_assert (std::size (s_aFavoriteCommunityButtons) == (size_t )PAGE_FAVORITE_COMMUNITY_5 - PAGE_FAVORITE_COMMUNITY_1 + 1 );
720+ static_assert (std::size (s_aFavoriteCommunityButtons) == (size_t )BIT_TAB_FAVORITE_COMMUNITY_5 - BIT_TAB_FAVORITE_COMMUNITY_1 + 1 );
721+ static_assert (std::size (s_aFavoriteCommunityButtons) == (size_t )IServerBrowser::TYPE_FAVORITE_COMMUNITY_5 - IServerBrowser::TYPE_FAVORITE_COMMUNITY_1 + 1 );
722+ for (const CCommunity *pCommunity : ServerBrowser ()->FavoriteCommunities ())
723+ {
724+ if (Box.w < BrowserButtonWidth)
725+ break ;
726+ Box.VSplitLeft (BrowserButtonWidth, &Button, &Box);
727+ const int Page = PAGE_FAVORITE_COMMUNITY_1 + FavoriteCommunityIndex;
728+ const char *pName = pCommunity->Name ();
729+
730+ if (g_Config.m_ClEnableCommunities == 0 )
731+ {
732+ if (str_comp (pCommunity->Id (), IServerBrowser::COMMUNITY_DDNET) == 0 )
733+ {
734+ pName = " DDNet" ;
735+ }
736+ else if (str_comp (pCommunity->Id (), " kog" ) == 0 )
737+ {
738+ pName = " KoG" ;
739+ }
740+ }
741+
742+ if (DoButton_MenuTab (&s_aFavoriteCommunityButtons[FavoriteCommunityIndex], pName, ActivePage == Page, &Button, IGraphics::CORNER_T, &m_aAnimatorsBigPage[BIT_TAB_FAVORITE_COMMUNITY_1 + FavoriteCommunityIndex], nullptr , nullptr , nullptr , 10 .0f , FindCommunityIcon (pCommunity->Id ())))
743+ {
744+ NewPage = Page;
745+ }
746+ GameClient ()->m_Tooltips .DoToolTip (&s_aFavoriteCommunityButtons[FavoriteCommunityIndex], &Button, pCommunity->Name ());
747+
748+ ++FavoriteCommunityIndex;
749+ if (FavoriteCommunityIndex >= std::size (s_aFavoriteCommunityButtons))
750+ break ;
751+ }
693752 }
694753
695754 int MaxPage = PAGE_FAVORITES + ServerBrowser ()->FavoriteCommunities ().size ();
@@ -712,31 +771,6 @@ void CMenus::RenderMenubar(CUIRect Box, IClient::EClientState ClientState)
712771 NewPage = MaxPage;
713772 }
714773 }
715-
716- size_t FavoriteCommunityIndex = 0 ;
717- static CButtonContainer s_aFavoriteCommunityButtons[5 ];
718- static_assert (std::size (s_aFavoriteCommunityButtons) == (size_t )PAGE_FAVORITE_COMMUNITY_5 - PAGE_FAVORITE_COMMUNITY_1 + 1 );
719- static_assert (std::size (s_aFavoriteCommunityButtons) == (size_t )BIT_TAB_FAVORITE_COMMUNITY_5 - BIT_TAB_FAVORITE_COMMUNITY_1 + 1 );
720- static_assert (std::size (s_aFavoriteCommunityButtons) == (size_t )IServerBrowser::TYPE_FAVORITE_COMMUNITY_5 - IServerBrowser::TYPE_FAVORITE_COMMUNITY_1 + 1 );
721- for (const CCommunity *pCommunity : ServerBrowser ()->FavoriteCommunities ())
722- {
723- if (Box.w < BrowserButtonWidth)
724- break ;
725- Box.VSplitLeft (BrowserButtonWidth, &Button, &Box);
726- const int Page = PAGE_FAVORITE_COMMUNITY_1 + FavoriteCommunityIndex;
727- if (DoButton_MenuTab (&s_aFavoriteCommunityButtons[FavoriteCommunityIndex], FONT_ICON_ELLIPSIS, ActivePage == Page, &Button, IGraphics::CORNER_T, &m_aAnimatorsBigPage[BIT_TAB_FAVORITE_COMMUNITY_1 + FavoriteCommunityIndex], nullptr , nullptr , nullptr , 10 .0f , FindCommunityIcon (pCommunity->Id ())))
728- {
729- NewPage = Page;
730- }
731- GameClient ()->m_Tooltips .DoToolTip (&s_aFavoriteCommunityButtons[FavoriteCommunityIndex], &Button, pCommunity->Name ());
732-
733- ++FavoriteCommunityIndex;
734- if (FavoriteCommunityIndex >= std::size (s_aFavoriteCommunityButtons))
735- break ;
736- }
737-
738- TextRender ()->SetRenderFlags (0 );
739- TextRender ()->SetFontPreset (EFontPreset::DEFAULT_FONT);
740774 }
741775 else
742776 {
0 commit comments