#include <Main/globals.hxx>
#include <Scenery/scenery.hxx>
+#include <Scripting/NasalSys.hxx>
#include "AIBase.hxx"
SGPropertyNode *prop_root,
double sim_time_sec)
{
- model = sgLoad3DModel(fg_root, path, prop_root, sim_time_sec);
+ model = sgLoad3DModel(fg_root, path, prop_root, sim_time_sec, 0,
+ new FGNasalModelData(prop_root));
model->setNodeMask(model->getNodeMask() & ~SG_NODEMASK_TERRAIN_BIT);
return model.get();
}
user_pitch_node = fgGetNode("/orientation/pitch-deg", true);
user_yaw_node = fgGetNode("/orientation/side-slip-deg", true);
user_speed_node = fgGetNode("/velocities/uBody-fps", true);
+}
- /// Move that into the constructor
+void FGAIManager::postinit() {
+ // postinit, so that it can access the Nasal subsystem
for(int i = 0 ; i < root->nChildren() ; i++) {
SGPropertyNode *aiEntry = root->getChild( i );
if( !strcmp( aiEntry->getName(), "scenario" ) ) {
~FGAIManager();
void init();
+ void postinit();
void reinit();
void bind();
void unbind();
_module = path;
const char *s = load ? load->getStringValue() : "";
FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
- nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s));
+ nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _props);
}
FGNasalModelData::~FGNasalModelData()
if(_unload) {
const char *s = _unload->getStringValue();
- nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s));
+ nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _props);
}
nas->deleteModule(_module.c_str());
}
class FGNasalModelData : public SGModelData {
public:
- FGNasalModelData() : _unload(0) {}
+ FGNasalModelData(SGPropertyNode *props = 0) : _props(props), _unload(0) {}
~FGNasalModelData();
void modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *);
private:
string _module;
+ SGPropertyNode_ptr _props;
SGConstPropertyNode_ptr _unload;
};