Skip to content

Commit 3584a39

Browse files
committed
Add ability to disable custom communities
1 parent 0984d1d commit 3584a39

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/engine/shared/config_variables_tclient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,4 @@ MACRO_CONFIG_STR(TcExecuteOnJoin, tc_execute_on_join, 100, "Run a console comman
261261
MACRO_CONFIG_INT(TcExecuteOnJoinDelay, tc_execute_on_join_delay, 2, 7, 50000, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Tick delay before executing tc_execute_on_join")
262262

263263
// Custom Communities
264-
MACRO_CONFIG_STR(TcCustomCommunitiesUrl, tc_custom_communities_url, 256, "https://raw.githubusercontent.com/SollyBunny/ddnet-custom-communities/refs/heads/main/custom-communities-ddnet-info.json", CFGFLAG_CLIENT | CFGFLAG_SAVE, "URL to fetch custom communities from (must be https)")
264+
MACRO_CONFIG_STR(TcCustomCommunitiesUrl, tc_custom_communities_url, 256, "https://raw.githubusercontent.com/SollyBunny/ddnet-custom-communities/refs/heads/main/custom-communities-ddnet-info.json", CFGFLAG_CLIENT | CFGFLAG_SAVE, "URL to fetch custom communities from (must be https), empty to disable")

src/game/client/components/tclient/custom_communities.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void CCustomCommunities::LoadCustomCommunitiesDDNetInfo()
4646

4747
void CCustomCommunities::CustomCommunitiesFunction(std::vector<json_value *> &vCommunities)
4848
{
49-
if(m_pCustomCommunitiesDDNetInfo)
49+
if(m_pCustomCommunitiesDDNetInfo && g_Config.m_TcCustomCommunitiesUrl[0] != '\0')
5050
{
5151
const json_value &Communities = (*m_pCustomCommunitiesDDNetInfo)["communities"];
5252
if(Communities.type == json_array)
@@ -61,6 +61,8 @@ void CCustomCommunities::CustomCommunitiesFunction(std::vector<json_value *> &vC
6161

6262
void CCustomCommunities::OnInit()
6363
{
64+
if(g_Config.m_TcCustomCommunitiesUrl[0] == 0)
65+
return;
6466
m_pCustomCommunitiesDDNetInfoTask = HttpGetFile(g_Config.m_TcCustomCommunitiesUrl, Storage(), CUSTOM_COMMUNITIES_DDNET_INFO_FILE, IStorage::TYPE_SAVE);
6567
m_pCustomCommunitiesDDNetInfoTask->Timeout(CTimeout{10000, 0, 500, 10});
6668
m_pCustomCommunitiesDDNetInfoTask->SkipByFileTime(false); // Always re-download.

0 commit comments

Comments
 (0)