From 7a9fee975ab9e5d83e3942a9f40028de4df42000 Mon Sep 17 00:00:00 2001 From: BrentVL-1952840 <70229620+Brentdevent@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:33:34 +0200 Subject: [PATCH] Unload mods on non-modded servers --- src/client/component/party.cpp | 2 +- src/client/component/workshop.cpp | 8 +++++++- src/client/component/workshop.hpp | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index d0127989..0ee400d5 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -42,7 +42,7 @@ namespace party { 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::CL_ConnectFromLobby(0, &info, &addr, 1, 0, mapname.data(), gamemode.data(), usermap_id.data()); diff --git a/src/client/component/workshop.cpp b/src/client/component/workshop.cpp index 74a8cf7b..42375b7c 100644 --- a/src/client/component/workshop.cpp +++ b/src/client/component/workshop.cpp @@ -240,11 +240,17 @@ namespace workshop 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") { game::loadMod(0, mod.data(), true); + return; + } + + if (game::isModLoaded()) + { + game::loadMod(0, "", true); } } diff --git a/src/client/component/workshop.hpp b/src/client/component/workshop.hpp index 0e373623..394ebd0a 100644 --- a/src/client/component/workshop.hpp +++ b/src/client/component/workshop.hpp @@ -7,5 +7,5 @@ namespace workshop 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_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); }