1
0
Fork 0

- fix regression: classes derived from SGModelData get the props root

via modelLoaded, not a possible Nasal node.
- rename SGNasalModelData::_props to ::_root to avoid confusion
This commit is contained in:
mfranz 2008-10-18 18:47:28 +00:00
parent 76b609738f
commit e1d72f8253
2 changed files with 10 additions and 6 deletions

View file

@ -1092,9 +1092,12 @@ void FGNasalModelData::modelLoaded(const string& path, SGPropertyNode *prop,
{
if(!prop)
return;
SGPropertyNode *nasal = prop->getNode("nasal");
if(!nasal)
return;
SGPropertyNode *load = prop->getNode("load");
_unload = prop->getNode("unload");
SGPropertyNode *load = nasal->getNode("load");
_unload = nasal->getNode("unload");
if(!load && !_unload)
return;
@ -1102,7 +1105,8 @@ void FGNasalModelData::modelLoaded(const string& path, SGPropertyNode *prop,
if(_props)
_module += ':' + _props->getPath();
const char *s = load ? load->getStringValue() : "";
nasalSys->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _props);
nasalSys->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _root);
_props = 0;
}
FGNasalModelData::~FGNasalModelData()
@ -1118,7 +1122,7 @@ FGNasalModelData::~FGNasalModelData()
if(_unload) {
const char *s = _unload->getStringValue();
nasalSys->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _props);
nasalSys->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _root);
}
nasalSys->deleteModule(_module.c_str());
}

View file

@ -161,13 +161,13 @@ private:
class FGNasalModelData : public simgear::SGModelData {
public:
FGNasalModelData(SGPropertyNode *props = 0) : _props(props), _unload(0) {}
FGNasalModelData(SGPropertyNode *root = 0) : _root(root), _unload(0) {}
~FGNasalModelData();
void modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *);
private:
string _module;
SGPropertyNode_ptr _props;
SGPropertyNode_ptr _root;
SGConstPropertyNode_ptr _unload;
};