diff --git a/src/client/component/mods.cpp b/src/client/component/mods.cpp index fb124d2a..aad8c6ac 100644 --- a/src/client/component/mods.cpp +++ b/src/client/component/mods.cpp @@ -63,25 +63,25 @@ namespace mods utils::nt::relaunch_self(mode.append(arg), true); utils::nt::terminate(); } - } - bool mod_requires_restart(const std::string& path) - { - return utils::io::file_exists(path + "/mod.ff") || utils::io::file_exists(path + "/zone/mod.ff"); - } - - void set_filesystem_data(const std::string& path) - { - if (mod_path.has_value()) + bool mod_requires_restart(const std::string& path) { - filesystem::unregister_path(mod_path.value()); + return utils::io::file_exists(path + "/mod.ff") || utils::io::file_exists(path + "/zone/mod.ff"); } - if (!game::environment::is_sp()) + void set_filesystem_data(const std::string& path) { - // modify fs_game on mp/dedi because its not set when we obviously vid_restart (sp does a full relaunch with command line arguments) - game::Dvar_SetFromStringByNameFromSource("fs_game", path.data(), - game::DVAR_SOURCE_INTERNAL); + if (mod_path.has_value()) + { + filesystem::unregister_path(mod_path.value()); + } + + if (!game::environment::is_sp()) + { + // modify fs_game on mp/dedi because its not set when we obviously vid_restart (sp does a full relaunch with command line arguments) + game::Dvar_SetFromStringByNameFromSource("fs_game", path.data(), + game::DVAR_SOURCE_INTERNAL); + } } } diff --git a/src/client/component/mods.hpp b/src/client/component/mods.hpp index f7b47293..6359a7ab 100644 --- a/src/client/component/mods.hpp +++ b/src/client/component/mods.hpp @@ -2,5 +2,7 @@ namespace mods { + void set_mod(const std::string& path); + void clear_mod(); std::optional get_mod(); } \ No newline at end of file diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index 6962600f..a136f8b6 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -9,6 +9,7 @@ #include "server_list.hpp" #include "download.hpp" #include "fastfiles.hpp" +#include "mods.hpp" #include "game/game.hpp" #include "game/ui_scripting/execution.hpp" @@ -263,8 +264,7 @@ namespace party if (server_fs_game.empty() && !client_fs_game.empty()) { - game::Dvar_SetFromStringByNameFromSource("fs_game", "", - game::DVAR_SOURCE_INTERNAL); + mods::clear_mod(); return true; } @@ -297,8 +297,7 @@ namespace party } else if (client_fs_game != server_fs_game) { - game::Dvar_SetFromStringByNameFromSource("fs_game", server_fs_game.data(), - game::DVAR_SOURCE_INTERNAL); + mods::set_mod(server_fs_game); return true; }