Merge commit '13b41ab'

This commit is contained in:
Phillip Stephens 2018-04-26 14:11:49 -07:00
commit 031c139e2d
2 changed files with 9 additions and 0 deletions

View File

@ -80,6 +80,7 @@ private:
public: public:
Console(CVarManager*); Console(CVarManager*);
void registerCommand(std::string_view name, std::string_view helpText, std::string_view usage, const std::function<void(Console*, const std::vector<std::string>&)>&& func); void registerCommand(std::string_view name, std::string_view helpText, std::string_view usage, const std::function<void(Console*, const std::vector<std::string>&)>&& func);
void unregisterCommand(std::string_view name);
void executeString(const std::string& strToExec); void executeString(const std::string& strToExec);

View File

@ -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)}; 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) void Console::executeString(const std::string& str)
{ {
if (str.empty()) if (str.empty())