use set/clear mod functions
This commit is contained in:
parent
0c2c90e786
commit
e0ae1b14fe
@ -63,25 +63,25 @@ namespace mods
|
|||||||
utils::nt::relaunch_self(mode.append(arg), true);
|
utils::nt::relaunch_self(mode.append(arg), true);
|
||||||
utils::nt::terminate();
|
utils::nt::terminate();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool mod_requires_restart(const std::string& path)
|
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())
|
|
||||||
{
|
{
|
||||||
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)
|
if (mod_path.has_value())
|
||||||
game::Dvar_SetFromStringByNameFromSource("fs_game", path.data(),
|
{
|
||||||
game::DVAR_SOURCE_INTERNAL);
|
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
|
namespace mods
|
||||||
{
|
{
|
||||||
|
void set_mod(const std::string& path);
|
||||||
|
void clear_mod();
|
||||||
std::optional<std::string> get_mod();
|
std::optional<std::string> get_mod();
|
||||||
}
|
}
|
@ -9,6 +9,7 @@
|
|||||||
#include "server_list.hpp"
|
#include "server_list.hpp"
|
||||||
#include "download.hpp"
|
#include "download.hpp"
|
||||||
#include "fastfiles.hpp"
|
#include "fastfiles.hpp"
|
||||||
|
#include "mods.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
#include "game/ui_scripting/execution.hpp"
|
#include "game/ui_scripting/execution.hpp"
|
||||||
@ -263,8 +264,7 @@ namespace party
|
|||||||
|
|
||||||
if (server_fs_game.empty() && !client_fs_game.empty())
|
if (server_fs_game.empty() && !client_fs_game.empty())
|
||||||
{
|
{
|
||||||
game::Dvar_SetFromStringByNameFromSource("fs_game", "",
|
mods::clear_mod();
|
||||||
game::DVAR_SOURCE_INTERNAL);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,8 +297,7 @@ namespace party
|
|||||||
}
|
}
|
||||||
else if (client_fs_game != server_fs_game)
|
else if (client_fs_game != server_fs_game)
|
||||||
{
|
{
|
||||||
game::Dvar_SetFromStringByNameFromSource("fs_game", server_fs_game.data(),
|
mods::set_mod(server_fs_game);
|
||||||
game::DVAR_SOURCE_INTERNAL);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user