]> git.mxchange.org Git - simgear.git/commitdiff
Reset: commands can be removed
authorJames Turner <zakalawe@mac.com>
Tue, 5 Nov 2013 05:17:05 +0000 (05:17 +0000)
committerJames Turner <zakalawe@mac.com>
Tue, 5 Nov 2013 05:21:52 +0000 (05:21 +0000)
simgear/structure/commands.cxx
simgear/structure/commands.hxx

index f293c16b264324ec344d93eaa53f1f3a7cfb0089..91d5928e139a882044c13273337e4e36a0d362f3 100644 (file)
@@ -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
index 699cd055ded50e3b9df394abf4116cf488ff8920..c9ad2370f9cd6e27e631e1f6e060d139d7ac5495 100644 (file)
@@ -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.