2014-12-10 10:21:13 +00:00
|
|
|
#include <engine/serverbrowser.h>
|
|
|
|
#include <base/system.h>
|
|
|
|
|
2016-04-29 16:17:06 +00:00
|
|
|
// gametypes
|
|
|
|
|
|
|
|
bool IsVanilla(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return !str_comp(pInfo->m_aGameType, "DM")
|
|
|
|
|| !str_comp(pInfo->m_aGameType, "TDM")
|
|
|
|
|| !str_comp(pInfo->m_aGameType, "CTF");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsCatch(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return str_find_nocase(pInfo->m_aGameType, "catch");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsInsta(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return str_find_nocase(pInfo->m_aGameType, "idm")
|
|
|
|
|| str_find_nocase(pInfo->m_aGameType, "itdm")
|
|
|
|
|| str_find_nocase(pInfo->m_aGameType, "ictf");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsFNG(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return str_find_nocase(pInfo->m_aGameType, "fng");
|
|
|
|
}
|
|
|
|
|
2014-12-10 10:21:13 +00:00
|
|
|
bool IsRace(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return str_find_nocase(pInfo->m_aGameType, "race")
|
2018-08-26 19:21:27 +00:00
|
|
|
|| IsFastCap(pInfo)
|
|
|
|
|| IsDDRace(pInfo);
|
2014-12-10 10:21:13 +00:00
|
|
|
}
|
|
|
|
|
2017-09-09 18:54:49 +00:00
|
|
|
bool IsFastCap(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return str_find_nocase(pInfo->m_aGameType, "fastcap");
|
|
|
|
}
|
|
|
|
|
2014-12-10 10:21:13 +00:00
|
|
|
bool IsDDRace(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return str_find_nocase(pInfo->m_aGameType, "ddrace")
|
2018-08-26 19:21:27 +00:00
|
|
|
|| str_find_nocase(pInfo->m_aGameType, "mkrace")
|
|
|
|
|| IsDDNet(pInfo);
|
2014-12-10 10:21:13 +00:00
|
|
|
}
|
|
|
|
|
2018-10-29 20:33:33 +00:00
|
|
|
bool IsBlockInfectionZ(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return str_find_nocase(pInfo->m_aGameType, "blockZ")
|
|
|
|
|| str_find_nocase(pInfo->m_aGameType, "infectionZ");
|
|
|
|
}
|
|
|
|
|
2019-04-11 22:46:54 +00:00
|
|
|
bool IsBlockWorlds(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return (str_comp_nocase_num(pInfo->m_aGameType, "bw ", 4) == 0)
|
|
|
|
|| (str_comp_nocase(pInfo->m_aGameType, "bw") == 0);
|
|
|
|
}
|
|
|
|
|
2014-12-10 10:21:13 +00:00
|
|
|
bool IsDDNet(const CServerInfo *pInfo)
|
|
|
|
{
|
2019-05-14 22:32:15 +00:00
|
|
|
return (pInfo->m_Flags & SERVER_FLAG_ISDDNET
|
|
|
|
|| str_find_nocase(pInfo->m_aGameType, "ddracenet")
|
2019-05-19 21:11:16 +00:00
|
|
|
|| str_find_nocase(pInfo->m_aGameType, "ddnet"))
|
2019-01-14 16:31:07 +00:00
|
|
|
&& !IsBlockInfectionZ(pInfo);
|
2018-09-28 16:27:51 +00:00
|
|
|
}
|
|
|
|
|
2016-04-29 16:17:06 +00:00
|
|
|
// other
|
|
|
|
|
2014-12-10 10:21:13 +00:00
|
|
|
bool Is64Player(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return str_find(pInfo->m_aGameType, "64")
|
|
|
|
|| str_find(pInfo->m_aName, "64")
|
2018-10-29 20:33:33 +00:00
|
|
|
|| IsDDNet(pInfo)
|
2019-05-19 21:11:16 +00:00
|
|
|
|| IsBlockInfectionZ(pInfo)
|
2019-05-19 21:35:56 +00:00
|
|
|
|| IsBlockWorlds(pInfo);
|
2014-12-10 10:21:13 +00:00
|
|
|
}
|
2015-08-30 19:42:16 +00:00
|
|
|
|
|
|
|
bool IsPlus(const CServerInfo *pInfo)
|
|
|
|
{
|
|
|
|
return str_find(pInfo->m_aGameType, "+");
|
2015-11-16 20:15:37 +00:00
|
|
|
}
|