void
FGAIBase::removeModel()
{
+ if (!_model.valid())
+ return;
+
FGScenery* pSceneryManager = globals->get_scenery();
if (pSceneryManager)
{
}
-bool FGAIBase::init(bool search_in_AI_path) {
-
+bool FGAIBase::init(bool search_in_AI_path)
+{
+ if (_model.valid())
+ {
+ SG_LOG(SG_AI, SG_ALERT, "AIBase: Cannot initialize a model multiple times! " << model_path);
+ return false;
+ }
+
string f;
if(search_in_AI_path)
{
_aimodel = new FGAIModelData(props);
osg::Node * mdl = SGModelLib::loadDeferredModel(f, props, _aimodel);
- if (_model.valid())
- {
- // reinit, dump the old model
- removeModel();
- }
-
_model = new osg::LOD;
_model->setName("AI-model range animation node");
{
const char* fxpath = prop->getStringValue("sound/path");
if (fxpath) {
- string sound_path = string(fxpath);
- if (sound_path != "") {
- _path = "/AI/"+sound_path;
- }
+ _path = string(fxpath);
}
_nasal->modelLoaded(path, prop, n);
}