1
0
Fork 0

Vivian MEAZZA:

"BUGFIX - fix initiation order - make sure that the AI Model list is
populated before we attempt to attach submodels."
This commit is contained in:
mfranz 2007-04-27 11:02:39 +00:00
parent 235b35ef9a
commit 3233ce8a44
2 changed files with 18 additions and 14 deletions

View file

@ -26,7 +26,6 @@ const double FGSubmodelMgr::lbs_to_slugs = 0.031080950172;
FGSubmodelMgr::FGSubmodelMgr() FGSubmodelMgr::FGSubmodelMgr()
{ {
x_offset = y_offset = 0.0; x_offset = y_offset = 0.0;
z_offset = -4.0; z_offset = -4.0;
pitch_offset = 2.0; pitch_offset = 2.0;
@ -75,7 +74,10 @@ void FGSubmodelMgr::init()
_contrail_trigger->setBoolValue(false); _contrail_trigger->setBoolValue(false);
ai = (FGAIManager*)globals->get_subsystem("ai_model"); ai = (FGAIManager*)globals->get_subsystem("ai_model");
}
void FGSubmodelMgr::postinit() {
// postinit, so that the AI list is populated
loadAI(); loadAI();
} }
@ -95,7 +97,6 @@ void FGSubmodelMgr::unbind()
void FGSubmodelMgr::update(double dt) void FGSubmodelMgr::update(double dt)
{ {
if (!(_serviceable_node->getBoolValue())) if (!(_serviceable_node->getBoolValue()))
return; return;
@ -106,6 +107,7 @@ void FGSubmodelMgr::update(double dt)
_contrail_trigger->setBoolValue(_user_alt_node->getDoubleValue() > contrail_altitude); _contrail_trigger->setBoolValue(_user_alt_node->getDoubleValue() > contrail_altitude);
submodel_iterator = submodels.begin(); submodel_iterator = submodels.begin();
while (submodel_iterator != submodels.end()) { while (submodel_iterator != submodels.end()) {
i++; i++;
@ -483,6 +485,7 @@ void FGSubmodelMgr::loadAI()
while (sm_list_itr != end) { while (sm_list_itr != end) {
string path = (*sm_list_itr)->_getPath(); string path = (*sm_list_itr)->_getPath();
bool serviceable = (*sm_list_itr)->_getServiceable(); bool serviceable = (*sm_list_itr)->_getServiceable();
if (path.empty()) { if (path.empty()) {
++sm_list_itr; ++sm_list_itr;
continue; continue;

View file

@ -90,6 +90,7 @@ public:
void load(); void load();
void init(); void init();
void postinit();
void bind(); void bind();
void unbind(); void unbind();
void update(double dt); void update(double dt);