mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
Add option to disable regional rankings.
Set config to true in tests Add test for `´sv_regional_rankings`
This commit is contained in:
parent
7a2004e836
commit
bf98eec518
|
@ -220,6 +220,7 @@ MACRO_CONFIG_INT(SvSpecFrequency, sv_pause_frequency, 1, 0, 9999, CFGFLAG_SERVER
|
||||||
MACRO_CONFIG_INT(SvInvite, sv_invite, 1, 0, 1, CFGFLAG_SERVER, "Whether players can invite other players to teams")
|
MACRO_CONFIG_INT(SvInvite, sv_invite, 1, 0, 1, CFGFLAG_SERVER, "Whether players can invite other players to teams")
|
||||||
MACRO_CONFIG_INT(SvInviteFrequency, sv_invite_frequency, 1, 0, 9999, CFGFLAG_SERVER, "The minimum allowed delay between invites")
|
MACRO_CONFIG_INT(SvInviteFrequency, sv_invite_frequency, 1, 0, 9999, CFGFLAG_SERVER, "The minimum allowed delay between invites")
|
||||||
MACRO_CONFIG_INT(SvTeleOthersAuthLevel, sv_tele_others_auth_level, 1, 1, 3, CFGFLAG_SERVER, "The auth level you need to tele others")
|
MACRO_CONFIG_INT(SvTeleOthersAuthLevel, sv_tele_others_auth_level, 1, 1, 3, CFGFLAG_SERVER, "The auth level you need to tele others")
|
||||||
|
MACRO_CONFIG_INT(SvRegionalRankings, sv_regional_rankings, 1, 0, 1, CFGFLAG_SERVER, "Display regional rankings in /rank and /top5")
|
||||||
|
|
||||||
MACRO_CONFIG_INT(SvEmotionalTees, sv_emotional_tees, 1, -1, 1, CFGFLAG_SERVER, "Whether eye change of tees is enabled with emoticons = 1, not = 0, -1 not at all")
|
MACRO_CONFIG_INT(SvEmotionalTees, sv_emotional_tees, 1, -1, 1, CFGFLAG_SERVER, "Whether eye change of tees is enabled with emoticons = 1, not = 0, -1 not at all")
|
||||||
MACRO_CONFIG_INT(SvEmoticonMsDelay, sv_emoticon_ms_delay, 3000, 20, 999999999, CFGFLAG_SERVER, "The time in ms a player has to wait before allowing the next over-head emoticons")
|
MACRO_CONFIG_INT(SvEmoticonMsDelay, sv_emoticon_ms_delay, 3000, 20, 999999999, CFGFLAG_SERVER, "The time in ms a player has to wait before allowing the next over-head emoticons")
|
||||||
|
|
|
@ -809,10 +809,18 @@ bool CScoreWorker::ShowRank(IDbConnection *pSqlServer, const ISqlData *pGameData
|
||||||
pData->m_aName, aBuf, BetterThanPercent, pData->m_aRequestingPlayer);
|
pData->m_aName, aBuf, BetterThanPercent, pData->m_aRequestingPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(g_Config.m_SvRegionalRankings)
|
||||||
|
{
|
||||||
str_format(pResult->m_Data.m_aaMessages[1], sizeof(pResult->m_Data.m_aaMessages[1]),
|
str_format(pResult->m_Data.m_aaMessages[1], sizeof(pResult->m_Data.m_aaMessages[1]),
|
||||||
"Global rank %d - %s %s",
|
"Global rank %d - %s %s",
|
||||||
Rank, pData->m_aServer, aRegionalRank);
|
Rank, pData->m_aServer, aRegionalRank);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str_format(pResult->m_Data.m_aaMessages[1], sizeof(pResult->m_Data.m_aaMessages[1]),
|
||||||
|
"Global rank %d", Rank);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -961,6 +969,9 @@ bool CScoreWorker::ShowTop(IDbConnection *pSqlServer, const ISqlData *pGameData,
|
||||||
Line++;
|
Line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!g_Config.m_SvRegionalRankings)
|
||||||
|
return !End;
|
||||||
|
|
||||||
char aServerLike[16];
|
char aServerLike[16];
|
||||||
str_format(aServerLike, sizeof(aServerLike), "%%%s%%", pData->m_aServer);
|
str_format(aServerLike, sizeof(aServerLike), "%%%s%%", pData->m_aServer);
|
||||||
|
|
||||||
|
|
|
@ -143,8 +143,9 @@ struct SingleScore : public Score
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(SingleScore, Top)
|
TEST_P(SingleScore, TopRegional)
|
||||||
{
|
{
|
||||||
|
g_Config.m_SvRegionalRankings = true;
|
||||||
ASSERT_FALSE(CScoreWorker::ShowTop(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
ASSERT_FALSE(CScoreWorker::ShowTop(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
||||||
ExpectLines(m_pPlayerResult,
|
ExpectLines(m_pPlayerResult,
|
||||||
{"------------ Global Top ------------",
|
{"------------ Global Top ------------",
|
||||||
|
@ -152,14 +153,32 @@ TEST_P(SingleScore, Top)
|
||||||
"------------ GER Top ------------"});
|
"------------ GER Top ------------"});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(SingleScore, Rank)
|
TEST_P(SingleScore, Top)
|
||||||
{
|
{
|
||||||
|
g_Config.m_SvRegionalRankings = false;
|
||||||
|
ASSERT_FALSE(CScoreWorker::ShowTop(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
||||||
|
ExpectLines(m_pPlayerResult,
|
||||||
|
{"------------ Global Top ------------",
|
||||||
|
"1. nameless tee Time: 01:40.00"});
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_P(SingleScore, RankRegional)
|
||||||
|
{
|
||||||
|
g_Config.m_SvRegionalRankings = true;
|
||||||
ASSERT_FALSE(CScoreWorker::ShowRank(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
ASSERT_FALSE(CScoreWorker::ShowRank(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
||||||
ExpectLines(m_pPlayerResult, {"nameless tee - 01:40.00 - better than 100% - requested by brainless tee", "Global rank 1 - GER unranked"}, true);
|
ExpectLines(m_pPlayerResult, {"nameless tee - 01:40.00 - better than 100% - requested by brainless tee", "Global rank 1 - GER unranked"}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(SingleScore, TopServer)
|
TEST_P(SingleScore, Rank)
|
||||||
{
|
{
|
||||||
|
g_Config.m_SvRegionalRankings = false;
|
||||||
|
ASSERT_FALSE(CScoreWorker::ShowRank(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
||||||
|
ExpectLines(m_pPlayerResult, {"nameless tee - 01:40.00 - better than 100% - requested by brainless tee", "Global rank 1"}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_P(SingleScore, TopServerRegional)
|
||||||
|
{
|
||||||
|
g_Config.m_SvRegionalRankings = true;
|
||||||
str_copy(m_PlayerRequest.m_aServer, "USA", sizeof(m_PlayerRequest.m_aServer));
|
str_copy(m_PlayerRequest.m_aServer, "USA", sizeof(m_PlayerRequest.m_aServer));
|
||||||
ASSERT_FALSE(CScoreWorker::ShowTop(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
ASSERT_FALSE(CScoreWorker::ShowTop(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
||||||
ExpectLines(m_pPlayerResult,
|
ExpectLines(m_pPlayerResult,
|
||||||
|
@ -169,13 +188,32 @@ TEST_P(SingleScore, TopServer)
|
||||||
"1. nameless tee Time: 01:40.00"});
|
"1. nameless tee Time: 01:40.00"});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(SingleScore, RankServer)
|
TEST_P(SingleScore, TopServer)
|
||||||
{
|
{
|
||||||
|
g_Config.m_SvRegionalRankings = false;
|
||||||
|
str_copy(m_PlayerRequest.m_aServer, "USA", sizeof(m_PlayerRequest.m_aServer));
|
||||||
|
ASSERT_FALSE(CScoreWorker::ShowTop(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
||||||
|
ExpectLines(m_pPlayerResult,
|
||||||
|
{"------------ Global Top ------------",
|
||||||
|
"1. nameless tee Time: 01:40.00"});
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_P(SingleScore, RankServerRegional)
|
||||||
|
{
|
||||||
|
g_Config.m_SvRegionalRankings = true;
|
||||||
str_copy(m_PlayerRequest.m_aServer, "USA", sizeof(m_PlayerRequest.m_aServer));
|
str_copy(m_PlayerRequest.m_aServer, "USA", sizeof(m_PlayerRequest.m_aServer));
|
||||||
ASSERT_FALSE(CScoreWorker::ShowRank(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
ASSERT_FALSE(CScoreWorker::ShowRank(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
||||||
ExpectLines(m_pPlayerResult, {"nameless tee - 01:40.00 - better than 100% - requested by brainless tee", "Global rank 1 - USA rank 1"}, true);
|
ExpectLines(m_pPlayerResult, {"nameless tee - 01:40.00 - better than 100% - requested by brainless tee", "Global rank 1 - USA rank 1"}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_P(SingleScore, RankServer)
|
||||||
|
{
|
||||||
|
g_Config.m_SvRegionalRankings = false;
|
||||||
|
str_copy(m_PlayerRequest.m_aServer, "USA", sizeof(m_PlayerRequest.m_aServer));
|
||||||
|
ASSERT_FALSE(CScoreWorker::ShowRank(m_pConn, &m_PlayerRequest, m_aError, sizeof(m_aError))) << m_aError;
|
||||||
|
ExpectLines(m_pPlayerResult, {"nameless tee - 01:40.00 - better than 100% - requested by brainless tee", "Global rank 1"}, true);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_P(SingleScore, LoadPlayerData)
|
TEST_P(SingleScore, LoadPlayerData)
|
||||||
{
|
{
|
||||||
InsertRank(120.0, true);
|
InsertRank(120.0, true);
|
||||||
|
|
Loading…
Reference in a new issue