]> git.mxchange.org Git - flightgear.git/commitdiff
Go back to the simpler arrangement syntax of a map of vectors.
authordavid <david>
Sun, 19 Jan 2003 23:03:31 +0000 (23:03 +0000)
committerdavid <david>
Sun, 19 Jan 2003 23:03:31 +0000 (23:03 +0000)
src/GUI/menubar.cxx
src/GUI/menubar.hxx

index b79894cd0c599c2c4ee565d8625cc34d88de5a4f..3d1049bac1b584ddd1e4eea788c5ceab54dc0169 100644 (file)
@@ -282,12 +282,11 @@ FGMenuBar::~FGMenuBar ()
     delete _menuBar;            // FIXME: check if PUI owns the pointer
 
                                 // Delete all those bindings
-    map<string,vector<FGBinding *>*>::iterator it;
+    map<string,vector<FGBinding *> >::iterator it;
     it = _bindings.begin();
     while (it != _bindings.end()) {
-        for (int i = 0; i < it->second->size(); i++)
-            delete (*it->second)[i];
-        delete it->second;
+        for (int i = 0; i < it->second.size(); i++)
+            delete it->second[i];
     }
 }
 
@@ -329,10 +328,10 @@ void
 FGMenuBar::fireItem (puObject * item)
 {
     const char * name = item->getLegend();
-    vector<FGBinding *> bindings = _bindings[name];
+    vector<FGBinding *> &bindings = _bindings[name];
 
-    for (int i = 0; i < bindings->size(); i++)
-        (*bindings)[i]->fire();
+    for (int i = 0; i < bindings.size(); i++)
+        bindings[i]->fire();
 }
 
 void
@@ -358,10 +357,8 @@ FGMenuBar::make_menu (SGPropertyNode_ptr node)
         vector<SGPropertyNode_ptr> binding_nodes =
             item_nodes[i]->getChildren("binding");
 
-        if (_bindings[items[j]] == 0)
-            _bindings[items[j]] = new vector<FGBinding *>;
         for (int k = 0; k < binding_nodes.size(); k++)
-            _bindings[items[j]]->push_back(new FGBinding(binding_nodes[k]));
+            _bindings[items[j]].push_back(new FGBinding(binding_nodes[k]));
     }
 
     items[item_nodes.size()] = 0;
index 12ee7a56e8787344976c00fe61a99c77f816072c..4dabf20c7bc528364cb78b5ec25e9dc6b4aaac9d 100644 (file)
@@ -82,7 +82,7 @@ private:
 
     bool _visible;
     puMenuBar * _menuBar;
-    map<string,vector<FGBinding *>*> _bindings;
+    map<string,vector<FGBinding *> > _bindings;
 };
 
 #endif // __MENUBAR_HXX