use set/clear mod functions

This commit is contained in:
m 2022-12-22 11:33:44 -06:00
parent 0c2c90e786
commit e0ae1b14fe
3 changed files with 19 additions and 18 deletions

View File

@ -63,7 +63,6 @@ namespace mods
utils::nt::relaunch_self(mode.append(arg), true);
utils::nt::terminate();
}
}
bool mod_requires_restart(const std::string& path)
{
@ -84,6 +83,7 @@ namespace mods
game::DVAR_SOURCE_INTERNAL);
}
}
}
void set_mod(const std::string& path)
{

View File

@ -2,5 +2,7 @@
namespace mods
{
void set_mod(const std::string& path);
void clear_mod();
std::optional<std::string> get_mod();
}

View File

@ -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;
}