void
NewGUI::update (double delta_time_sec)
{
- // NO OP
+ map<string,FGDialog *>::iterator iter = _active_dialogs.begin();
+ for(/**/; iter != _active_dialogs.end(); iter++)
+ iter->second->update();
}
bool
// algorithm to do (delete map entries by value, not key)? I hate
// the STL :) -Andy
map<string,FGDialog *>::iterator iter = _active_dialogs.begin();
- for(/**/; iter != _active_dialogs.end(); iter++)
- if(iter->second == _active_dialog)
+ for(/**/; iter != _active_dialogs.end(); iter++) {
+ if(iter->second == _active_dialog) {
_active_dialogs.erase(iter);
+ // iter is no longer valid
+ break;
+ }
+ }
delete _active_dialog;
_active_dialog = 0;
SG_LOG(SG_GENERAL, SG_ALERT, "New dialog has no <name> property");
return;
}
- string name = props->getStringValue("name");
- _dialog_props[name] = props;
+ string name = cname;
+ if(!_active_dialogs[name])
+ _dialog_props[name] = props;
}
void
SGPropertyNode * props = new SGPropertyNode;
try {
readProperties(subpath, props);
- } catch (const sg_exception &ex) {
+ } catch (const sg_exception &) {
SG_LOG(SG_INPUT, SG_ALERT, "Error parsing dialog "
<< subpath);
delete props;
continue;
}
- if (!props->hasValue("name")) {
+ SGPropertyNode *nameprop = props->getNode("name");
+ if (!nameprop) {
SG_LOG(SG_INPUT, SG_WARN, "dialog " << subpath
<< " has no name; skipping.");
delete props;
continue;
}
- newDialog(props);
+ string name = nameprop->getStringValue();
+ if (_dialog_props[name])
+ delete (SGPropertyNode *)_dialog_props[name];
+
+ _dialog_props[name] = props;
}
}
ulCloseDir(dir);