#include <simgear/props/props.hxx>
#include <Main/globals.hxx>
+#include <Main/fg_props.hxx>
#include <Scenery/scenery.hxx>
#include <Scripting/NasalSys.hxx>
#include <Scripting/NasalModelData.hxx>
#include <Sound/fg_fx.hxx>
+#include "AIFlightPlan.hxx"
#include "AIBase.hxx"
#include "AIManager.hxx"
bool getInteriorLoaded(void) { return _interiorLoaded;}
bool hasInteriorPath(void) { return _hasInteriorPath;}
inline std::string& getInteriorPath() { return _interiorPath; }
-
private:
std::auto_ptr<FGNasalModelDataProxy> _nasal;
std::string _fxpath;
return;
FGScenery* pSceneryManager = globals->get_scenery();
- if (pSceneryManager)
+ if (pSceneryManager && pSceneryManager->get_models_branch())
{
osg::ref_ptr<osg::Object> temp = _model.get();
pSceneryManager->get_models_branch()->removeChild(aip.getSceneGraph());
}
else
{
- SG_LOG(SG_AI, SG_ALERT, "AIBase: Could not unload model. Missing scenery manager!");
+ aip.clear();
+ _model = 0;
+ _modeldata = 0;
}
}
return id;
}
-
-
+bool FGAIBase::isValid() {
+ //Either no flightplan or it is valid
+ return !fp || fp->isValidPlan();
+}