diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index 18f79a6..26eae19 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -33,9 +33,9 @@ namespace command params params = {}; const auto command = utils::string::to_lower(params[0]); - if (handlers.contains(command)) + if (const auto itr = handlers.find(command); itr != handlers.end()) { - handlers[command](params); + itr->second(params); } } @@ -50,9 +50,9 @@ namespace command params_sv params = {}; const auto command = utils::string::to_lower(params[0]); - if (const auto got = handlers_sv.find(command); got != handlers_sv.end()) + if (const auto itr = handlers_sv.find(command); itr != handlers_sv.end()) { - got->second(&game::mp::g_entities[client_num], params); + itr->second(&game::mp::g_entities[client_num], params); } client_command_hook.invoke(client_num); @@ -219,7 +219,7 @@ namespace command }); } - void add_sv(const char* name, std::function callback) + void add_sv(const char* name, const std::function& callback) { // doing this so the sv command would show up in the console add_raw(name, nullptr); @@ -227,7 +227,9 @@ namespace command const auto command = utils::string::to_lower(name); if (!handlers_sv.contains(command)) - handlers_sv[command] = std::move(callback); + { + handlers_sv[command] = callback; + } } bool cheats_ok(const game::mp::gentity_s* ent) diff --git a/src/client/component/command.hpp b/src/client/component/command.hpp index bb7e3e0..16563f7 100644 --- a/src/client/component/command.hpp +++ b/src/client/component/command.hpp @@ -44,7 +44,7 @@ namespace command void add(const char* name, const std::function& callback); void add(const char* name, const std::function& callback); - void add_sv(const char* name, std::function callback); + void add_sv(const char* name, const std::function& callback); void execute(std::string command, bool sync = false); } diff --git a/src/client/component/gsc/script_extension.cpp b/src/client/component/gsc/script_extension.cpp index 6721be2..342b977 100644 --- a/src/client/component/gsc/script_extension.cpp +++ b/src/client/component/gsc/script_extension.cpp @@ -171,9 +171,9 @@ namespace gsc void scr_register_function_stub(void* func, int type, unsigned int name) { - if (const auto got = builtin_funcs_overrides.find(name); got != builtin_funcs_overrides.end()) + if (const auto itr = builtin_funcs_overrides.find(name); itr != builtin_funcs_overrides.end()) { - func = got->second; + func = itr->second; } scr_register_function_hook.invoke(func, type, name); diff --git a/src/client/component/gsc/script_loading.cpp b/src/client/component/gsc/script_loading.cpp index 249c466..528ed99 100644 --- a/src/client/component/gsc/script_loading.cpp +++ b/src/client/component/gsc/script_loading.cpp @@ -81,9 +81,9 @@ namespace gsc game::ScriptFile* load_custom_script(const char* file_name, const std::string& real_name) { - if (const auto got = loaded_scripts.find(real_name); got != loaded_scripts.end()) + if (const auto itr = loaded_scripts.find(real_name); itr != loaded_scripts.end()) { - return got->second; + return itr->second; } std::string source_buffer{};