diff --git a/hecl/include/hecl/Console.hpp b/hecl/include/hecl/Console.hpp index 6e6cd6f64..f863b12bd 100644 --- a/hecl/include/hecl/Console.hpp +++ b/hecl/include/hecl/Console.hpp @@ -80,6 +80,7 @@ private: public: Console(CVarManager*); void registerCommand(std::string_view name, std::string_view helpText, std::string_view usage, const std::function&)>&& func); + void unregisterCommand(std::string_view name); void executeString(const std::string& strToExec); diff --git a/hecl/lib/Console.cpp b/hecl/lib/Console.cpp index a6d03c330..c7ef715c2 100644 --- a/hecl/lib/Console.cpp +++ b/hecl/lib/Console.cpp @@ -32,6 +32,14 @@ void Console::registerCommand(std::string_view name, std::string_view helpText, m_commands[lowName] = SConsoleCommand{name.data(), helpText.data(), usage.data(), std::move(func)}; } +void Console::unregisterCommand(std::string_view name) +{ + std::string lowName = name.data(); + athena::utility::tolower(lowName); + if (m_commands.find(lowName) != m_commands.end()) + m_commands.erase(m_commands.find(lowName)); +} + void Console::executeString(const std::string& str) { if (str.empty())