diff --git a/src/AIModel/AICarrier.cxx b/src/AIModel/AICarrier.cxx index 84775fa58..6c33639e3 100644 --- a/src/AIModel/AICarrier.cxx +++ b/src/AIModel/AICarrier.cxx @@ -92,7 +92,7 @@ bool FGAICarrier::init() { // Attach a pointer to this carrier class to those objects. mark_wires(sel, wire_objects); mark_cat(sel, catapult_objects); - mark_solid(sel, solid_objects); + mark_solid(sel, solid_objects, false); return true; } @@ -160,13 +160,18 @@ bool FGAICarrier::mark_wires(ssgEntity* e, const list& wire_objects) { return found; } -bool FGAICarrier::mark_solid(ssgEntity* e, const list& solid_objects) { +bool FGAICarrier::mark_solid(ssgEntity* e, const list& solid_objects, bool mark) { bool found = false; if (e->isAKindOf(ssgTypeBranch())) { ssgBranch* br = (ssgBranch*)e; ssgEntity* kid; + + list::const_iterator it; + for (it = solid_objects.begin(); it != solid_objects.end(); ++it) + mark = mark || e->getName() && (*it) == e->getName(); + for ( kid = br->getKid(0); kid != NULL ; kid = br->getNextKid() ) - found = mark_solid(kid, solid_objects) || found; + found = mark_solid(kid, solid_objects, mark) || found; if (found) br->setTraversalMaskBits(SSGTRAV_HOT); @@ -174,7 +179,7 @@ bool FGAICarrier::mark_solid(ssgEntity* e, const list& solid_objects) { } else if (e->isAKindOf(ssgTypeLeaf())) { list::const_iterator it; for (it = solid_objects.begin(); it != solid_objects.end(); ++it) { - if (e->getName() && (*it) == e->getName()) { + if (mark || (e->getName() && (*it) == e->getName())) { e->setTraversalMaskBits(SSGTRAV_HOT); e->setUserData( FGAICarrierHardware::newSolid( this ) ); found = true; diff --git a/src/AIModel/AICarrier.hxx b/src/AIModel/AICarrier.hxx index 15f2bdf45..a9ae9e962 100644 --- a/src/AIModel/AICarrier.hxx +++ b/src/AIModel/AICarrier.hxx @@ -92,7 +92,7 @@ private: void mark_nohot(ssgEntity*); bool mark_wires(ssgEntity*, const list&); bool mark_cat(ssgEntity*, const list&); - bool mark_solid(ssgEntity*, const list&); + bool mark_solid(ssgEntity*, const list&, bool); list solid_objects; // List of solid object names list wire_objects; // List of wire object names