Skip to content

Commit e2e2e08

Browse files
committed
Add 'sv_maps_base_url' to support map download https urls
1 parent 9797da8 commit e2e2e08

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/engine/server/server.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ void CServer::SendMap(int ClientId)
12141214
Msg.AddRaw(&m_aCurrentMapSha256[MapType].data, sizeof(m_aCurrentMapSha256[MapType].data));
12151215
Msg.AddInt(m_aCurrentMapCrc[MapType]);
12161216
Msg.AddInt(m_aCurrentMapSize[MapType]);
1217-
Msg.AddString("", 0); // HTTPS map download URL
1217+
Msg.AddString(m_MapDownloadUrl[MapType].c_str(), 0);
12181218
SendMsg(&Msg, MSGFLAG_VITAL, ClientId);
12191219
}
12201220
{
@@ -2583,6 +2583,15 @@ int CServer::LoadMap(const char *pMapName)
25832583
str_copy(m_aCurrentMap, pMapName);
25842584
m_pCurrentMapName = fs_filename(m_aCurrentMap);
25852585

2586+
if(Config()->m_SvMapsBaseUrl[0])
2587+
{
2588+
m_MapDownloadUrl[MAP_TYPE_SIX] = Config()->m_SvMapsBaseUrl + std::string("/") + aBuf;
2589+
}
2590+
else
2591+
{
2592+
m_MapDownloadUrl[MAP_TYPE_SIX].clear();
2593+
}
2594+
25862595
// load complete map into memory for download
25872596
{
25882597
free(m_apCurrentMapData[MAP_TYPE_SIX]);

src/engine/server/server.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ class CServer : public IServer
247247
unsigned m_aCurrentMapCrc[NUM_MAP_TYPES];
248248
unsigned char *m_apCurrentMapData[NUM_MAP_TYPES];
249249
unsigned int m_aCurrentMapSize[NUM_MAP_TYPES];
250+
std::string m_MapDownloadUrl[NUM_MAP_TYPES];
250251

251252
CDemoRecorder m_aDemoRecorder[NUM_RECORDERS];
252253
CAuthManager m_AuthManager;

src/engine/shared/config_variables.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ MACRO_CONFIG_INT(SvHighBandwidth, sv_high_bandwidth, 0, 0, 1, CFGFLAG_SERVER, "U
439439
MACRO_CONFIG_STR(SvRegister, sv_register, 16, "1", CFGFLAG_SERVER, "Register server with master server for public listing, can also accept a comma-separated list of protocols to register on, like 'ipv4,ipv6'")
440440
MACRO_CONFIG_STR(SvRegisterExtra, sv_register_extra, 256, "", CFGFLAG_SERVER, "Extra headers to send to the register endpoint, comma separated 'Header: Value' pairs")
441441
MACRO_CONFIG_STR(SvRegisterUrl, sv_register_url, 128, "https://master1.ddnet.org/ddnet/15/register", CFGFLAG_SERVER, "Masterserver URL to register to")
442+
MACRO_CONFIG_STR(SvMapsBaseUrl, sv_maps_base_url, 128, "", CFGFLAG_SERVER, "Client maps base URL (HTTPS)")
442443
MACRO_CONFIG_STR(SvRconPassword, sv_rcon_password, 128, "", CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, "Remote console password (full access)")
443444
MACRO_CONFIG_STR(SvRconModPassword, sv_rcon_mod_password, 128, "", CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, "Remote console password for moderators (limited access)")
444445
MACRO_CONFIG_STR(SvRconHelperPassword, sv_rcon_helper_password, 128, "", CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, "Remote console password for helpers (limited access)")

0 commit comments

Comments
 (0)