Unload mods on non-modded servers

This commit is contained in:
BrentVL-1952840 2023-04-24 14:33:34 +02:00
parent 89e1a6b91d
commit 7a9fee975a
3 changed files with 9 additions and 3 deletions

View File

@ -42,7 +42,7 @@ namespace party
{ {
auth::clear_stored_guids(); auth::clear_stored_guids();
workshop::load_mod_if_needed(usermap_id, mod_id); workshop::setup_same_mod_as_host(usermap_id, mod_id);
game::XSESSION_INFO info{}; game::XSESSION_INFO info{};
game::CL_ConnectFromLobby(0, &info, &addr, 1, 0, mapname.data(), gamemode.data(), usermap_id.data()); game::CL_ConnectFromLobby(0, &info, &addr, 1, 0, mapname.data(), gamemode.data(), usermap_id.data());

View File

@ -240,11 +240,17 @@ namespace workshop
return true; return true;
} }
void load_mod_if_needed(const std::string& usermap, const std::string& mod) void setup_same_mod_as_host(const std::string& usermap, const std::string& mod)
{ {
if (!usermap.empty() || mod != "usermaps") if (!usermap.empty() || mod != "usermaps")
{ {
game::loadMod(0, mod.data(), true); game::loadMod(0, mod.data(), true);
return;
}
if (game::isModLoaded())
{
game::loadMod(0, "", true);
} }
} }

View File

@ -7,5 +7,5 @@ namespace workshop
std::string get_mod_resized_name(const std::string& folder_name); std::string get_mod_resized_name(const std::string& folder_name);
bool check_valid_usermap_id(const std::string& mapname, const std::string& pub_id); bool check_valid_usermap_id(const std::string& mapname, const std::string& pub_id);
bool check_valid_mod_id(const std::string& pub_id); bool check_valid_mod_id(const std::string& pub_id);
void load_mod_if_needed(const std::string& usermap, const std::string& mod); void setup_same_mod_as_host(const std::string& usermap, const std::string& mod);
} }