[Download] send base url as part of inforesponse. also set client dvar correctly for downloader.

This commit is contained in:
TheApadayo 2017-06-15 12:52:29 -04:00
parent 195f6bb297
commit 579fa0a87c
2 changed files with 29 additions and 12 deletions

View File

@ -777,6 +777,8 @@ namespace Components
Dvar::Register<const char*>("ui_dl_timeLeft", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
Dvar::Register<const char*>("ui_dl_progress", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
Dvar::Register<const char*>("ui_dl_transRate", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
Dvar::Register<bool>("sv_wwwDownload", false, Game::dvar_flag::DVAR_FLAG_DEDISAVED, "Set to true to enable downloading maps/mods from an external server.");
Dvar::Register<const char*>("sv_wwwBaseUrl", "", Game::dvar_flag::DVAR_FLAG_DEDISAVED, "Set to the base url for the external map download.");
});
UIScript::Add("mod_download_cancel", [] (UIScript::Token)

View File

@ -370,6 +370,9 @@ namespace Components
info.set("matchtype", "0");
}
info.set("wwwDownload", (Dvar::Var("sv_wwwDownload").get<bool>() ? "1" : "0"));
info.set("wwwUrl", Dvar::Var("sv_wwwBaseUrl").get<std::string>());
Network::SendCommand(address, "infoResponse", "\\" + info.build());
});
@ -393,6 +396,18 @@ namespace Components
std::string mod = Dvar::Var("fs_game").get<std::string>();
// set fast server stuff here so its updated when we go to download stuff
if (info.get("wwwDownload") == "1"s)
{
Dvar::Var("sv_wwwDownload").set(true);
Dvar::Var("sv_wwwBaseUrl").set(info.get("wwwUrl"));
}
else
{
Dvar::Var("sv_wwwDownload").set(false);
Dvar::Var("sv_wwwBaseUrl").set("");
}
if (info.get("challenge") != Party::Container.challenge)
{
Party::ConnectError("Invalid join response: Challenge mismatch.");