diff --git a/src/engine/client.h b/src/engine/client.h index 8ff978900..3ed77e036 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -204,7 +204,7 @@ public: virtual void OnRconType(bool UsernameReq) = 0; virtual void OnRconLine(const char *pLine) = 0; - virtual void OnDDRaceScore(int AllowDDRaceScore, bool Dummy) = 0; + virtual void OnTimeScore(int AllowTimeScore, bool Dummy) = 0; virtual void OnInit() = 0; virtual void OnNewSnapshot() = 0; virtual void OnEnterGame() = 0; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 31e727d4c..be4223b88 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -721,7 +721,7 @@ void CClient::Connect(const char *pAddress, const char *pPassword) GenerateTimeoutCodes(); - GameClient()->OnDDRaceScore(1, false); + GameClient()->OnTimeScore(1, false); } void CClient::DisconnectWithReason(const char *pReason) @@ -808,7 +808,7 @@ void CClient::DummyConnect() //connecting to the server m_NetClient[1].Connect(&m_ServerAddress); - GameClient()->OnDDRaceScore(1, true); + GameClient()->OnTimeScore(1, true); } void CClient::DummyDisconnect(const char *pReason) @@ -1938,15 +1938,12 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket) bool UsernameReq = Unpacker.GetInt() & 1; GameClient()->OnRconType(UsernameReq); } - else if(Msg == NETMSG_DDRACE_SCORE) + else if(Msg == NETMSG_TIME_SCORE) { - int NewDDRaceScore = Unpacker.GetInt(); + int NewTimeScore = Unpacker.GetInt(); if (Unpacker.Error()) return; - if (!g_Config.m_ClDummy) - GameClient()->OnDDRaceScore(NewDDRaceScore, false); - else - GameClient()->OnDDRaceScore(NewDDRaceScore, true); + GameClient()->OnTimeScore(NewTimeScore, g_Config.m_ClDummy) } } else @@ -2170,10 +2167,10 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket) } else if(Msg == NETMSG_DDRACE_SCORE) { - int NewDDRaceScore = Unpacker.GetInt(); + int NewTimeScore = Unpacker.GetInt(); if (Unpacker.Error()) return; - GameClient()->OnDDRaceScore(NewDDRaceScore, true); + GameClient()->OnTimeScore(NewTimeScore, true); } } else diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index d95e969fa..0aa96f823 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1012,10 +1012,6 @@ void CServer::SendMapData(int ClientID, int Chunk) void CServer::SendConnectionReady(int ClientID) { - CMsgPacker aMsg(NETMSG_DDRACE_SCORE); - aMsg.AddInt(g_Config.m_SvDDRaceScore); - SendMsgEx(&aMsg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientID, true); - CMsgPacker Msg(NETMSG_CON_READY); SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true); } @@ -2095,13 +2091,6 @@ void CServer::ConRescue(CConsole::IResult *pResult, void *pUser) ((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf); } -void CServer::ConDDRaceScore(CConsole::IResult *pResult, void *pUser) -{ - char aBuf[128]; - str_format(aBuf, sizeof(aBuf), "Value: %d", g_Config.m_SvDDRaceScore); - ((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf); -} - void CServer::ConKick(IConsole::IResult *pResult, void *pUser) { if(pResult->NumArguments() > 1) @@ -2974,7 +2963,6 @@ int main(int argc, const char **argv) // ignore_convention pConsole->Register("sv_test_cmds", "", CFGFLAG_SERVER, CServer::ConTestingCommands, pConsole, "Turns testing commands aka cheats on/off"); pConsole->Register("sv_rescue", "", CFGFLAG_SERVER, CServer::ConRescue, pConsole, "Allow /rescue command so players can teleport themselves out of freeze"); - pConsole->Register("sv_ddrace_score", "", CFGFLAG_SERVER, CServer::ConDDRaceScore, pConsole, "Allows the client to use DDRace scores"); pEngine->InitLogfile(); diff --git a/src/engine/server/server.h b/src/engine/server/server.h index a27b70093..bce48a96e 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -306,7 +306,6 @@ public: static void ConTestingCommands(IConsole::IResult *pResult, void *pUser); static void ConRescue(IConsole::IResult *pResult, void *pUser); - static void ConDDRaceScore(IConsole::IResult *pResult, void *pUser); static void ConKick(IConsole::IResult *pResult, void *pUser); static void ConStatus(IConsole::IResult *pResult, void *pUser); static void ConShutdown(IConsole::IResult *pResult, void *pUser); diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index a8b71f10e..2c4f64d39 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -156,7 +156,6 @@ MACRO_CONFIG_STR(SvDnsblKey, sv_dnsbl_key, 128, "", CFGFLAG_SERVER|CFGFLAG_NONTE MACRO_CONFIG_INT(SvDnsblVote, sv_dnsbl_vote, 0, 0, 1, CFGFLAG_SERVER, "Block votes by blacklisted addresses") MACRO_CONFIG_INT(SvDnsblBan, sv_dnsbl_ban, 0, 0, 1, CFGFLAG_SERVER, "Automatically ban blacklisted addresses") MACRO_CONFIG_INT(SvRconVote, sv_rcon_vote, 0, 0, 1, CFGFLAG_SERVER, "Only allow authed clients to call votes") -MACRO_CONFIG_INT(SvDDRaceScore, sv_ddrace_score, 1, 0, 1, CFGFLAG_SERVER, "Allows the client to use DDRace scores") MACRO_CONFIG_INT(SvPlayerDemoRecord, sv_player_demo_record, 0, 0, 1, CFGFLAG_SERVER, "Automatically record demos for each player") MACRO_CONFIG_INT(SvDemoChat, sv_demo_chat, 0, 0, 1, CFGFLAG_SERVER, "Record chat for demos") diff --git a/src/engine/shared/protocol_ex_msgs.h b/src/engine/shared/protocol_ex_msgs.h index 0ac0c932d..854810e1e 100644 --- a/src/engine/shared/protocol_ex_msgs.h +++ b/src/engine/shared/protocol_ex_msgs.h @@ -25,4 +25,4 @@ UUID(NETMSG_IDONTKNOW, "i-dont-know@ddnet.tw") UUID(NETMSG_RCONTYPE, "rcon-type@ddnet.tw") UUID(NETMSG_MAP_DETAILS, "map-details@ddnet.tw") -UUID(NETMSG_DDRACE_SCORE, "ddrace-score@ddnet.tw") +UUID(NETMSG_TIME_SCORE, "time-score@ddnet.tw") diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 67b0e8682..1c553c2aa 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -340,7 +340,7 @@ void CHud::RenderScoreHud() { CServerInfo Info; Client()->GetServerInfo(&Info); - if(IsRace(&Info) && g_Config.m_ClDDRaceScoreBoard && ((m_pClient->m_AllowDDRaceScore[0] && !g_Config.m_ClDummy) || (m_pClient->m_AllowDDRaceScore[1] && g_Config.m_ClDummy))) + if(IsRace(&Info) && g_Config.m_ClDDRaceScoreBoard && m_pClient->m_AllowTimeScore[g_Config.m_ClDummy]) { if(apPlayerInfo[t]->m_Score != -9999) str_format(aScore[t], sizeof(aScore[t]), "%02d:%02d", abs(apPlayerInfo[t]->m_Score)/60, abs(apPlayerInfo[t]->m_Score)%60); diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index 96a868034..cc35ce4a6 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -222,7 +222,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch } } - if(m_IsGameTypeRace && g_Config.m_ClDDRaceScoreBoard && ((m_pClient->m_AllowDDRaceScore[0] && !g_Config.m_ClDummy) || (m_pClient->m_AllowDDRaceScore[1] && g_Config.m_ClDummy))) + if(m_IsGameTypeRace && g_Config.m_ClDDRaceScoreBoard && m_pClient->m_AllowTimeScore[g_Config.m_ClDummy]) { if (m_ServerRecord > 0) { @@ -404,7 +404,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch } // score - if(m_IsGameTypeRace && g_Config.m_ClDDRaceScoreBoard && ((m_pClient->m_AllowDDRaceScore[0] && !g_Config.m_ClDummy) || (m_pClient->m_AllowDDRaceScore[1] && g_Config.m_ClDummy))) + if(m_IsGameTypeRace && g_Config.m_ClDDRaceScoreBoard && m_pClient->m_AllowTimeScore[g_Config.m_ClDummy]) { if (pInfo->m_Score == -9999) aBuf[0] = 0; diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 67acd1cee..7b309c54b 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -937,12 +937,9 @@ void CGameClient::OnRconLine(const char *pLine) m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine); } -void CGameClient::OnDDRaceScore(int AllowDDRaceScore, bool Dummy) +void CGameClient::OnTimeScore(int AllowTimeScore, bool Dummy) { - if(!Dummy) - m_AllowDDRaceScore[0] = AllowDDRaceScore; - else - m_AllowDDRaceScore[1] = AllowDDRaceScore; + m_AllowTimeScore[Dummy] = AllowTimeScore; } void CGameClient::ProcessEvents() diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index f984c9e27..d0b20ff22 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -164,7 +164,7 @@ public: }; int m_ServerMode; - int m_AllowDDRaceScore[2]; + int m_AllowTimeScore[2]; int m_DemoSpecID; @@ -316,7 +316,7 @@ public: virtual void OnEnterGame(); virtual void OnRconType(bool UsernameReq); virtual void OnRconLine(const char *pLine); - virtual void OnDDRaceScore(int AllowDDRaceScore, bool Dummy); + virtual void OnTimeScore(int AllowTimeScore, bool Dummy); virtual void OnGameOver(); virtual void OnStartGame(); virtual void OnFlagGrab(int TeamID);