From 2e8e500d4f70725a95021caf4e3bd620a992a835 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 5 Nov 2013 05:17:05 +0000 Subject: [PATCH] Reset: commands can be removed --- simgear/structure/commands.cxx | 11 +++++++++++ simgear/structure/commands.hxx | 4 ++++ 2 files changed, 15 insertions(+) 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. -- 2.39.5