@@ -853,10 +853,74 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
853853 View.HSplitTop (6 .0f , nullptr , &View);
854854 CUIRect CommunityFilter;
855855 View.HSplitTop (19 .0f + 4 .0f * 17 .0f + CScrollRegion::HEIGHT_MAGIC_FIX, &CommunityFilter, &View);
856- View.HSplitTop (8 .0f , nullptr , &View);
857856 RenderServerbrowserCommunitiesFilter (CommunityFilter);
858857 }
859858
859+ // Pointer31, gametype filter selector
860+ if (str_length (Config ()->m_ClGametypeFilterList ) && View.h > RowHeight) {
861+ View.HSplitTop (6 .0f , nullptr , &View);
862+ CUIRect GametypeFilters; CUIRect GametypeFiltersHeader;
863+ View.HSplitBottom (8 .0f , &GametypeFilters, &View);
864+ GametypeFilters.HSplitTop (20 .0f , &GametypeFiltersHeader, &GametypeFilters);
865+
866+ GametypeFiltersHeader.Draw (ColorRGBA (0 .0f , 0 .0f , 0 .0f , 0 .3f ), IGraphics::CORNER_T, 4 .0f );
867+ Ui ()->DoLabel (&GametypeFiltersHeader, Localize (" Gametype Filters" ), 12 .0f , TEXTALIGN_MC);
868+
869+ GametypeFilters.Draw (ColorRGBA (0 .0f , 0 .0f , 0 .0f , 0 .15f ), IGraphics::CORNER_B, 4 .0f );
870+
871+ static CButtonContainer s_Buttons[11 ]; // if it's 10 it'll cause issues if the country/type filter is enabled... for some reason. thus +1
872+
873+ if (!(GametypeFilters.h < RowHeight)) {
874+ bool isSelected = str_comp (Config ()->m_BrFilterGametype , " " ) == 0 ;
875+ GametypeFilters.HSplitTop (RowHeight, &Button, &GametypeFilters);
876+ if (DoButton_CheckBox (&s_Buttons[10 ], " No filter" , isSelected, &Button))
877+ {
878+ str_copy (Config ()->m_BrFilterGametype , " " );
879+ Client ()->ServerBrowserUpdate ();
880+ }
881+ }
882+
883+ const char *pGametypeList = Config ()->m_ClGametypeFilterList ;
884+ const char *pGametypeNext = pGametypeList;
885+ const char *pHead = pGametypeNext;
886+ pHead = str_skip_whitespaces_const (pHead);
887+ pGametypeNext = pHead;
888+
889+ for (int i = 0 ; i < 9 ; i++)
890+ {
891+ int Len = 0 ;
892+ while (*pHead && !str_isspace (*pHead))
893+ {
894+ pHead++; Len++;
895+ }
896+
897+ char aBuf[128 ]; char bBuf[128 ];
898+ str_copy (aBuf, pGametypeNext, Len+1 );
899+ str_format (bBuf, sizeof (bBuf), " '%s'" , aBuf);
900+
901+ if (GametypeFilters.h < RowHeight)
902+ break ;
903+
904+ bool isSelected = str_comp (Config ()->m_BrFilterGametype , aBuf) == 0 ;
905+ GametypeFilters.HSplitTop (RowHeight, &Button, &GametypeFilters);
906+ if (DoButton_CheckBox (&s_Buttons[i], bBuf, isSelected, &Button))
907+ {
908+ str_copy (Config ()->m_BrFilterGametype , aBuf);
909+ Client ()->ServerBrowserUpdate ();
910+ }
911+
912+ if (!*pHead)
913+ break ;
914+
915+ pHead = str_skip_whitespaces_const (pHead);
916+
917+ if (!*pHead)
918+ break ;
919+
920+ pGametypeNext = pHead;
921+ }
922+ }
923+
860924 static CButtonContainer s_ResetButton;
861925 if (DoButton_Menu (&s_ResetButton, Localize (" Reset filter" ), 0 , &ResetButton))
862926 {
0 commit comments