use set/clear mod functions
This commit is contained in:
parent
1971f1b4eb
commit
404e2354f6
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,5 +2,7 @@
|
||||
|
||||
namespace mods
|
||||
{
|
||||
void set_mod(const std::string& path);
|
||||
void clear_mod();
|
||||
std::optional<std::string> get_mod();
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user