]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBase.cxx
Interim windows build fix
[flightgear.git] / src / AIModel / AIBase.cxx
index d933e68af0380fba264d42a4c8ac1c26288d2119..339de5f27f17557dd42b435722d19b238b4b42e8 100644 (file)
 #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"
 
@@ -219,7 +221,7 @@ FGAIBase::removeModel()
         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());
@@ -233,7 +235,9 @@ FGAIBase::removeModel()
     }
     else
     {
-        SG_LOG(SG_AI, SG_ALERT, "AIBase: Could not unload model. Missing scenery manager!");
+        aip.clear();
+        _model = 0;
+        _modeldata = 0;
     }
 }