diff --git a/simgear/structure/commands.cxx b/simgear/structure/commands.cxx index f293c16b..91d5928e 100644 --- a/simgear/structure/commands.cxx +++ b/simgear/structure/commands.cxx @@ -126,4 +126,15 @@ SGCommandMgr::execute (const std::string &name, const SGPropertyNode * arg) cons return false; } +bool SGCommandMgr::removeCommand(const std::string& name) +{ + command_map::iterator it = _commands.find(name); + if (it == _commands.end()) + return false; + + delete it->second; + _commands.erase(it); + return true; +} + // end of commands.cxx diff --git a/simgear/structure/commands.hxx b/simgear/structure/commands.hxx index 699cd055..c9ad2370 100644 --- a/simgear/structure/commands.hxx +++ b/simgear/structure/commands.hxx @@ -150,6 +150,10 @@ public: */ virtual bool execute (const std::string &name, const SGPropertyNode * arg) const; + /** + * Remove a command registration + */ + bool removeCommand(const std::string& name); protected: /** * Default constructor.