tiny changes

This commit is contained in:
m 2022-09-03 05:25:13 -05:00
parent 9fce064632
commit b913ea7129
4 changed files with 11 additions and 11 deletions

View File

@ -110,10 +110,8 @@ namespace command
void register_fs_game_path()
{
console::debug("[FS] " __FUNCTION__ " called\n");
static const auto* fs_game = game::Dvar_FindVar("fs_game");
const auto* new_mod_path = fs_game->current.string;
const auto new_mod_path = fs_game->current.string;
// check if the last saved fs_game value isn't empty and if it doesn't equal the new fs_game
if (!saved_fs_game.empty() && saved_fs_game != new_mod_path)
@ -124,12 +122,9 @@ namespace command
if (new_mod_path && !new_mod_path[0])
{
console::debug("[FS] " __FUNCTION__ " returning because new mod path is blank\n");
return;
}
console::debug("[FS] " __FUNCTION__ " registering new mod path\n");
// register fs_game value as a fs directory used for many things
filesystem::register_path(new_mod_path);
saved_fs_game = new_mod_path;
@ -597,6 +592,7 @@ namespace command
dvars::callback::on_new_value("fs_game", []()
{
console::warn("fs_game value changed, filesystem paths will be adjusted to new dvar value.");
register_fs_game_path();
});

View File

@ -172,8 +172,8 @@ namespace fastfiles
utils::hook::detour sys_createfile_hook;
HANDLE sys_create_file_stub(game::Sys_Folder folder, const char* base_filename)
{
auto* fs_basepath = game::Dvar_FindVar("fs_basepath");
auto* fs_game = game::Dvar_FindVar("fs_game");
static const auto* fs_basepath = game::Dvar_FindVar("fs_basepath");
static const auto* fs_game = game::Dvar_FindVar("fs_game");
std::string dir = fs_basepath ? fs_basepath->current.string : "";
std::string mod_dir = fs_game ? fs_game->current.string : "";
@ -232,8 +232,12 @@ namespace fastfiles
// ui
// common
//try_load_zone("h1_mod_common", true);
game::DB_LoadXAssets(data.data(), static_cast<std::uint32_t>(data.size()), syncMode);
// H2-mod has the try_load_zone for mod right here but before, we had it before the load assets call. guess quaK can let me know
// what to do about this
try_load_zone("mod", true);
}
@ -335,7 +339,7 @@ namespace fastfiles
}
const auto name = params.get(1);
if (!try_load_zone(name, false))
if (!try_load_zone(name, false, true))
{
console::warn("loadzone: zone \"%s\" could not be found!\n", name);
}

View File

@ -149,7 +149,7 @@ namespace mods
command::add("com_restart", []()
{
if (!game::Com_InFrontend())
if (!game::Com_InFrontend() && (game::environment::is_mp() && !game::VirtualLobby_Loaded()))
{
return;
}

View File

@ -219,7 +219,7 @@ namespace ui_scripting
game_type["addlocalizedstring"] = [](const game&, const std::string& string,
const std::string& value)
{
localized_strings::override(string, value);
localized_strings::override(string, value, true);
};
game_type["sharedset"] = [](const game&, const std::string& key, const std::string& value)