Skip to content

Commit d3ff05c

Browse files
committed
make sv_ko_mode string instead of int
1 parent 08ade55 commit d3ff05c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/engine/server/databases/sqlite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ bool CSqliteConnection::AddPoints_COTD(const char *pPlayer, int Points, char *pE
437437
"INSERT INTO %s_cotd_points_%s(Name, Points) "
438438
"VALUES (?, ?) "
439439
"ON CONFLICT(Name) DO UPDATE SET Points=Points+?",
440-
GetPrefix(), g_Config.m_SvKoMode == 0 ? "gores" : "race");
440+
GetPrefix(), g_Config.m_SvKoMode);
441441
if(PrepareStatement(aBuf, pError, ErrorSize))
442442
{
443443
return true;

src/engine/shared/config_variables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ MACRO_CONFIG_INT(SvKoPublicChat, sv_ko_public_chat, 0, 0, 1, CFGFLAG_SERVER, "ma
661661
MACRO_CONFIG_INT(SvKoFirstTo, sv_ko_first_to, 0, 0, 5, CFGFLAG_SERVER, "Activates ko-run mode, first to X wins the game (KO GAME)")
662662
MACRO_CONFIG_INT(SvForcePredictionMargin, sv_force_prediction_margin, 0, 0, 200, CFGFLAG_SERVER, "force players to have a higher prediction margin for more consistant gameplay")
663663
MACRO_CONFIG_INT(SvKoSQL, sv_ko_sql, 0, 0, 1, CFGFLAG_SERVER, "Save result of cup of the day in database")
664-
MACRO_CONFIG_INT(SvKoMode, sv_ko_mode, 0, 0, 1, CFGFLAG_SERVER, "Cup of the day Mode: 0 = gores, 1 = race")
664+
MACRO_CONFIG_STR(SvKoMode, sv_ko_mode, 128, "race", CFGFLAG_SERVER, "Cup of the day Mode, example usage: sv_ko_mode race")
665665
MACRO_CONFIG_INT(SvKoSetSlots, sv_ko_set_slots, 0, 0, 1, CFGFLAG_SERVER, "If slots are automatically set & unset by server")
666666

667667

src/game/server/gamemodes/DDRace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void CGameControllerDDRace::KO_Start()
3939
has_finished = false;
4040
bool finished = (GameServer()->ko_player_count <= 1);
4141

42-
if(GameServer()->ko_round >= g_Config.m_SvKoFirstTo*3)
42+
if(g_Config.m_SvKoFirstTo && GameServer()->ko_round >= g_Config.m_SvKoFirstTo*3)
4343
{
4444
GameServer()->SendChat(-1, TEAM_ALL, "Ran out of rounds");
4545
finished = true;

src/game/server/scoreworker.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ bool CScoreWorker::SaveCOTD_Points(IDbConnection *pSqlServer, const ISqlData *pG
829829
{
830830
str_format(aBuf, sizeof(aBuf),
831831
"SELECT COUNT(*) AS COTD_FINISH FROM %s_cotd_ranks_%s WHERE Map=? AND Name=? ORDER BY Rank ASC LIMIT 1",
832-
pSqlServer->GetPrefix(), g_Config.m_SvKoMode == 0 ? "gores" : "race");
832+
pSqlServer->GetPrefix(), g_Config.m_SvKoMode);
833833
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
834834
{
835835
return true;
@@ -847,7 +847,7 @@ bool CScoreWorker::SaveCOTD_Points(IDbConnection *pSqlServer, const ISqlData *pG
847847
{
848848
str_format(aBuf, sizeof(aBuf),
849849
"INSERT INTO %s_cotd_ranks_%s(Name, Map, Rank) VALUES(?, ?, %i)",
850-
pSqlServer->GetPrefix(), g_Config.m_SvKoMode == 0 ? "gores" : "race", pData->m_Rank);
850+
pSqlServer->GetPrefix(), g_Config.m_SvKoMode, pData->m_Rank);
851851

852852
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
853853
{
@@ -885,8 +885,8 @@ bool CScoreWorker::ShowCOTD_Points(IDbConnection *pSqlServer, const ISqlData *pG
885885
" SELECT Points FROM %s_cotd_points_%s WHERE Name = ?"
886886
")) as Ranking, Points, Name "
887887
"FROM %s_cotd_points_%s WHERE Name = ?",
888-
pSqlServer->GetPrefix(), g_Config.m_SvKoMode == 0 ? "gores" : "race", pSqlServer->GetPrefix(),
889-
g_Config.m_SvKoMode == 0 ? "gores" : "race", pSqlServer->GetPrefix(), g_Config.m_SvKoMode == 0 ? "gores" : "race");
888+
pSqlServer->GetPrefix(), g_Config.m_SvKoMode, pSqlServer->GetPrefix(),
889+
g_Config.m_SvKoMode, pSqlServer->GetPrefix(), g_Config.m_SvKoMode);
890890

891891
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
892892
{
@@ -909,12 +909,12 @@ bool CScoreWorker::ShowCOTD_Points(IDbConnection *pSqlServer, const ISqlData *pG
909909
pResult->m_MessageKind = CScorePlayerResult::ALL;
910910
str_format(paMessages[0], sizeof(paMessages[0]),
911911
"%d. %s COTD %s Points: %d, requested by %s",
912-
Rank, aName, g_Config.m_SvKoMode == 0 ? "gores" : "race", Count, pData->m_aRequestingPlayer);
912+
Rank, aName, g_Config.m_SvKoMode, Count, pData->m_aRequestingPlayer);
913913
}
914914
else
915915
{
916916
str_format(paMessages[0], sizeof(paMessages[0]),
917-
"%s has not collected any cotd %s points so far", pData->m_aName, g_Config.m_SvKoMode == 0 ? "gores" : "race");
917+
"%s has not collected any cotd %s points so far", pData->m_aName, g_Config.m_SvKoMode);
918918
}
919919
return false;
920920
}

0 commit comments

Comments
 (0)