From: James Turner Date: Tue, 5 Nov 2013 05:17:05 +0000 (+0000) Subject: Reset: commands can be removed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2e8e500d4f70725a95021caf4e3bd620a992a835;p=simgear.git Reset: commands can be removed --- 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.