#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;
if (!enabled)
return;
- FGTrafficManager *tmgr = (FGTrafficManager*) globals->get_subsystem("Traffic Manager");
+ FGTrafficManager *tmgr = (FGTrafficManager*) globals->get_subsystem("traffic-manager");
_dt = dt;
ai_list_iterator ai_list_itr = ai_list.begin();
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)
{
SGPropertyNode_ptr root = new SGPropertyNode;
readProperties(path.str(), root);
return root;
- } catch (const sg_exception &) {
- SG_LOG(SG_GENERAL, SG_DEBUG, "Incorrect path specified for AI "
- "scenario: \"" << path.str() << "\"");
+ } catch (const sg_exception &t) {
+ SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load scenario '"
+ << path.str() << "': " << t.getFormattedMessage());
return 0;
}
}