ddnet/src/engine/shared/serverbrowser.cpp

68 lines
1.6 KiB
C++
Raw Normal View History

2014-12-10 10:21:13 +00:00
#include <engine/serverbrowser.h>
#include <base/system.h>
// 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")
|| str_find_nocase(pInfo->m_aGameType, "fastcap");
}
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")
|| str_find_nocase(pInfo->m_aGameType, "mkrace");
}
bool IsDDNet(const CServerInfo *pInfo)
{
return str_find_nocase(pInfo->m_aGameType, "ddracenet")
2018-07-27 21:32:10 +00:00
|| str_find_nocase(pInfo->m_aGameType, "ddnet")
|| ((str_comp_nocase_num(pInfo->m_aGameType, "bw", 2) == 0 && str_length(pInfo->m_aGameType) > 3 && pInfo->m_aGameType[2] == ' ' && pInfo->m_aGameType[3] == ' ')
|| str_comp_nocase(pInfo->m_aGameType, "bw") == 0);
2018-07-26 19:34:24 +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")
|| IsDDNet(pInfo);
}
bool IsPlus(const CServerInfo *pInfo)
{
return str_find(pInfo->m_aGameType, "+");
2015-11-16 20:15:37 +00:00
}