]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIManager.cxx
Fixing an age old bug. AIAircraft arriving on an airport never received a proper...
[flightgear.git] / src / AIModel / AIManager.cxx
index 91ef652717e9cba4c7bdcb0f88fdcc3e322abc2c..2ad54837113ec7a6d5e22ca48583208603d54c82 100644 (file)
 #include "AIGroundVehicle.hxx"
 #include "AIEscort.hxx"
 
-FGAIManager::FGAIManager() {
+FGAIManager::FGAIManager() :
+    cb_ai_bare(SGPropertyChangeCallback<FGAIManager>(this,&FGAIManager::updateLOD,
+               fgGetNode("/sim/rendering/static-lod/ai-bare", true))),
+    cb_ai_detailed(SGPropertyChangeCallback<FGAIManager>(this,&FGAIManager::updateLOD,
+                   fgGetNode("/sim/rendering/static-lod/ai-detailed", true)))
+{
     _dt = 0.0;
     mNumAiModels = 0;
 
@@ -181,6 +186,18 @@ FGAIManager::update(double dt) {
     thermal_lift_node->setDoubleValue( strength );  // for thermals
 }
 
+/** update LOD settings of all AI/MP models */
+void
+FGAIManager::updateLOD(SGPropertyNode* node)
+{
+    ai_list_iterator ai_list_itr = ai_list.begin();
+    while(ai_list_itr != ai_list.end())
+    {
+        (*ai_list_itr)->updateLOD();
+        ++ai_list_itr;
+    }
+}
+
 void
 FGAIManager::attach(FGAIBase *model)
 {