mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
added strict gametype filtering
This commit is contained in:
parent
c6c4a4ed1b
commit
684e1788ed
|
@ -213,8 +213,16 @@ void CServerBrowser::Filter()
|
||||||
if(!Filtered && g_Config.m_BrFilterGametype[0] != 0)
|
if(!Filtered && g_Config.m_BrFilterGametype[0] != 0)
|
||||||
{
|
{
|
||||||
// match against game type
|
// match against game type
|
||||||
if(!str_find_nocase(m_ppServerlist[i]->m_Info.m_aGameType, g_Config.m_BrFilterGametype))
|
if (!g_Config.m_BrFilterGametypeStrict)
|
||||||
Filtered = 1;
|
{
|
||||||
|
if(!str_find_nocase(m_ppServerlist[i]->m_Info.m_aGameType, g_Config.m_BrFilterGametype))
|
||||||
|
Filtered = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (str_comp_nocase(m_ppServerlist[i]->m_Info.m_aGameType, g_Config.m_BrFilterGametype))
|
||||||
|
Filtered = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +233,8 @@ void CServerBrowser::Filter()
|
||||||
|
|
||||||
int CServerBrowser::SortHash() const
|
int CServerBrowser::SortHash() const
|
||||||
{
|
{
|
||||||
int i = g_Config.m_BrSort&0xf;
|
int i = g_Config.m_BrSort&0x7;
|
||||||
|
i |= g_Config.m_BrFilterGametypeStrict<<3;
|
||||||
i |= g_Config.m_BrFilterEmpty<<4;
|
i |= g_Config.m_BrFilterEmpty<<4;
|
||||||
i |= g_Config.m_BrFilterFull<<5;
|
i |= g_Config.m_BrFilterFull<<5;
|
||||||
i |= g_Config.m_BrFilterPw<<6;
|
i |= g_Config.m_BrFilterPw<<6;
|
||||||
|
|
|
@ -27,6 +27,7 @@ MACRO_CONFIG_INT(BrFilterFull, br_filter_full, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLI
|
||||||
MACRO_CONFIG_INT(BrFilterEmpty, br_filter_empty, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out empty server in browser", -1)
|
MACRO_CONFIG_INT(BrFilterEmpty, br_filter_empty, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out empty server in browser", -1)
|
||||||
MACRO_CONFIG_INT(BrFilterPw, br_filter_pw, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out password protected servers in browser", -1)
|
MACRO_CONFIG_INT(BrFilterPw, br_filter_pw, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out password protected servers in browser", -1)
|
||||||
MACRO_CONFIG_INT(BrFilterPing, br_filter_ping, 999, 0, 999, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Ping to filter by in the server browser", -1)
|
MACRO_CONFIG_INT(BrFilterPing, br_filter_ping, 999, 0, 999, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Ping to filter by in the server browser", -1)
|
||||||
|
MACRO_CONFIG_INT(BrFilterGametypeStrict, br_filter_gametype_strict, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter gametype strict", -1)
|
||||||
MACRO_CONFIG_STR(BrFilterGametype, br_filter_gametype, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Game types to filter", -1)
|
MACRO_CONFIG_STR(BrFilterGametype, br_filter_gametype, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Game types to filter", -1)
|
||||||
MACRO_CONFIG_INT(BrFilterPure, br_filter_pure, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard servers in browser", -1)
|
MACRO_CONFIG_INT(BrFilterPure, br_filter_pure, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard servers in browser", -1)
|
||||||
MACRO_CONFIG_INT(BrFilterPureMap, br_filter_pure_map, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard maps in browser", -1)
|
MACRO_CONFIG_INT(BrFilterPureMap, br_filter_pure_map, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard maps in browser", -1)
|
||||||
|
|
|
@ -436,6 +436,10 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
|
||||||
if (DoButton_CheckBox((char *)&g_Config.m_BrFilterPureMap, Localize("Standard map"), g_Config.m_BrFilterPureMap, &Button))
|
if (DoButton_CheckBox((char *)&g_Config.m_BrFilterPureMap, Localize("Standard map"), g_Config.m_BrFilterPureMap, &Button))
|
||||||
g_Config.m_BrFilterPureMap ^= 1;
|
g_Config.m_BrFilterPureMap ^= 1;
|
||||||
|
|
||||||
|
View.HSplitTop(20.0f, &Button, &View);
|
||||||
|
if (DoButton_CheckBox((char *)&g_Config.m_BrFilterGametypeStrict, Localize("Filter gametype strict"), g_Config.m_BrFilterGametypeStrict, &Button))
|
||||||
|
g_Config.m_BrFilterGametypeStrict ^= 1;
|
||||||
|
|
||||||
View.HSplitTop(5.0f, 0, &View);
|
View.HSplitTop(5.0f, 0, &View);
|
||||||
|
|
||||||
View.HSplitTop(19.0f, &Button, &View);
|
View.HSplitTop(19.0f, &Button, &View);
|
||||||
|
@ -467,6 +471,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
|
||||||
g_Config.m_BrFilterFull = 0;
|
g_Config.m_BrFilterFull = 0;
|
||||||
g_Config.m_BrFilterEmpty = 0;
|
g_Config.m_BrFilterEmpty = 0;
|
||||||
g_Config.m_BrFilterPw = 0;
|
g_Config.m_BrFilterPw = 0;
|
||||||
|
g_Config.m_BrFilterGametypeStrict = 0;
|
||||||
g_Config.m_BrFilterPing = 999;
|
g_Config.m_BrFilterPing = 999;
|
||||||
g_Config.m_BrFilterGametype[0] = 0;
|
g_Config.m_BrFilterGametype[0] = 0;
|
||||||
g_Config.m_BrFilterCompatversion = 1;
|
g_Config.m_BrFilterCompatversion = 1;
|
||||||
|
|
Loading…
Reference in a new issue