From 37d067a4019aa2759b55db9db4280b03fd66a612 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Wed, 1 Mar 2023 06:58:20 +0100 Subject: [PATCH] More cleanup --- src/client/component/script.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/client/component/script.cpp b/src/client/component/script.cpp index eba77ecf..7bdc3241 100644 --- a/src/client/component/script.cpp +++ b/src/client/component/script.cpp @@ -17,9 +17,7 @@ namespace script struct globals_t { std::unordered_map loaded_scripts; - }; - - globals_t globals; + } globals; game::RawFile* get_loaded_script(const std::string& name) { @@ -37,9 +35,8 @@ namespace script auto& allocator = *utils::memory::get_allocator(); const auto* file_string = allocator.duplicate_string(data); - const utils::nt::library host{}; const auto appdata_path = (game::get_appdata_path() / "data/").generic_string(); - const auto host_path = (host.get_folder() / "boiii/").generic_string(); + const auto host_path = (utils::nt::library{}.get_folder() / "boiii/").generic_string(); auto i = name.find(appdata_path); if (i != std::string::npos) @@ -94,15 +91,17 @@ namespace script load_scripts_folder((host.get_folder() / "boiii/scripts").string()); } - game::RawFile* db_findxassetheader_stub(game::XAssetType type, const char* name, bool errorIfMissing, - int waitTime) + game::RawFile* db_findxassetheader_stub(const game::XAssetType type, const char* name, + const bool error_if_missing, + const int wait_time) { if (type != game::ASSET_TYPE_SCRIPTPARSETREE) { - return db_findxassetheader_hook.invoke(type, name, errorIfMissing, waitTime); + return db_findxassetheader_hook.invoke(type, name, error_if_missing, wait_time); } - auto* asset_header = db_findxassetheader_hook.invoke(type, name, errorIfMissing, waitTime); + auto* asset_header = db_findxassetheader_hook.invoke( + type, name, error_if_missing, wait_time); if (globals.loaded_scripts.contains(name)) { auto* script = get_loaded_script(name);