From 91d86552cde0806b6f9b921b6ef8fa7c5e85465f Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 17 Oct 2024 23:43:07 +0200 Subject: [PATCH] Minor cleanup --- Source/Engine/Debug/DebugCommands.cpp | 17 +++++++++-------- Source/Engine/Debug/DebugCommands.h | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Source/Engine/Debug/DebugCommands.cpp b/Source/Engine/Debug/DebugCommands.cpp index e4af0268e..e9f5b9b93 100644 --- a/Source/Engine/Debug/DebugCommands.cpp +++ b/Source/Engine/Debug/DebugCommands.cpp @@ -99,10 +99,11 @@ namespace bool Inited = false; Array Commands; - void OnBinaryModuleLoaded(BinaryModule* module) + void FindDebugCommands(BinaryModule* module) { if (module == GetBinaryModuleCorlib()) return; + PROFILE_CPU(); #if USE_CSHARP if (auto* managedModule = dynamic_cast(module)) @@ -200,9 +201,9 @@ namespace const auto& modules = BinaryModule::GetModules(); for (BinaryModule* module : modules) { - OnBinaryModuleLoaded(module); + FindDebugCommands(module); } - Scripting::BinaryModuleLoaded.Bind(&OnBinaryModuleLoaded); + Scripting::BinaryModuleLoaded.Bind(&FindDebugCommands); Scripting::ScriptsReloading.Bind(&OnScriptsReloading); } } @@ -219,7 +220,7 @@ public: { // Cleanup ScopeLock lock(Locker); - Scripting::BinaryModuleLoaded.Unbind(&OnBinaryModuleLoaded); + Scripting::BinaryModuleLoaded.Unbind(&FindDebugCommands); Scripting::ScriptsReloading.Unbind(&OnScriptsReloading); Commands.Clear(); Inited = true; @@ -252,12 +253,12 @@ void DebugCommands::Execute(StringView command) InitCommands(); // Find command to run - for (const CommandData& command : Commands) + for (const CommandData& cmd : Commands) { - if (name.Length() == command.Name.Length() && - StringUtils::CompareIgnoreCase(name.Get(), command.Name.Get(), name.Length()) == 0) + if (name.Length() == cmd.Name.Length() && + StringUtils::CompareIgnoreCase(name.Get(), cmd.Name.Get(), name.Length()) == 0) { - command.Invoke(args); + cmd.Invoke(args); return; } } diff --git a/Source/Engine/Debug/DebugCommands.h b/Source/Engine/Debug/DebugCommands.h index cedf39f57..e30ec048e 100644 --- a/Source/Engine/Debug/DebugCommands.h +++ b/Source/Engine/Debug/DebugCommands.h @@ -13,7 +13,7 @@ API_CLASS(static) class FLAXENGINE_API DebugCommands public: /// - /// Executees the command. + /// Executes the command. /// /// The command line (optionally with arguments). API_FUNCTION() static void Execute(StringView command);