From dbde1f2232a6f162fb34701a740069fe5e8c3d25 Mon Sep 17 00:00:00 2001 From: Durk Talsma Date: Thu, 14 May 2015 18:22:42 +0200 Subject: [PATCH] Some preparatory work for reinstating a missing piece of code in the routing algorithm for the AI system. --- src/AIModel/AIFlightPlanCreate.cxx | 12 +++++++++--- src/ATC/trafficcontrol.cxx | 6 +++--- src/Airports/groundnetwork.cxx | 9 +++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/AIModel/AIFlightPlanCreate.cxx b/src/AIModel/AIFlightPlanCreate.cxx index 676cb4cc9..308f87d00 100644 --- a/src/AIModel/AIFlightPlanCreate.cxx +++ b/src/AIModel/AIFlightPlanCreate.cxx @@ -270,7 +270,7 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight, if (node == -1) { node = park->guid(); } else if (node == 0) { - // HAndle case where parking doens't have a node + // Handle case where parking doesn't have a node if (firstFlight) { node = park->guid(); } else { @@ -311,6 +311,10 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight, // push each node on the taxi route as a waypoint // int route; //cerr << "Building taxi route" << endl; + + // Note that the line wpt->setRouteIndex was commented out by revision [afcdbd] 2012-01-01, + // which breaks the rendering functions. + // These can probably be generated on the fly however. while (taxiRoute.next(&node)) { char buffer[10]; snprintf(buffer, 10, "%lld", (long long int) node); @@ -319,7 +323,8 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight, FGAIWaypoint *wpt = createOnGround(ac, buffer, tn->geod(), apt->getElevation(), ac->getPerformance()->vTaxi()); - // wpt->setRouteIndex(route); + // TODO: find an alternative way to pass route information to the waypoint. + //wpt->setRouteIndex(route); //cerr << "Nodes left " << taxiRoute->nodesLeft() << " "; if (taxiRoute.nodesLeft() == 1) { // Note that we actually have hold points in the ground network, but this is just an initial test. @@ -416,7 +421,8 @@ bool FGAIFlightPlan::createLandingTaxi(FGAIAircraft * ac, FGAirport * apt, FGAIWaypoint *wpt = createOnGround(ac, buffer, tn->geod(), apt->getElevation(), ac->getPerformance()->vTaxi()); - // wpt->setRouteIndex(route); + //TODO: find an alternative way to pass route information to the waypoint. + //wpt->setRouteIndex(route); pushBackWaypoint(wpt); } return true; diff --git a/src/ATC/trafficcontrol.cxx b/src/ATC/trafficcontrol.cxx index 907818cfb..e25bb0a43 100644 --- a/src/ATC/trafficcontrol.cxx +++ b/src/ATC/trafficcontrol.cxx @@ -1048,7 +1048,7 @@ FGATCInstruction FGTowerController::getInstruction(int id) } void FGTowerController::render(bool visible) { - //cerr << "FGTowerController::render function not yet implemented" << endl; + //std::cerr << "FGTowerController::render function not yet implemented" << std::endl; } string FGTowerController::getName() { @@ -1315,7 +1315,7 @@ static void WorldCoordinate(osg::Matrix& obj_pos, double lat, void FGStartupController::render(bool visible) { - + //std::cerr << "Rendering startup controller" << std::endl; SGMaterialLib *matlib = globals->get_matlib(); if (group) { //int nr = ; @@ -1716,7 +1716,7 @@ ActiveRunway *FGApproachController::getRunway(const string& name) } void FGApproachController::render(bool visible) { - //cerr << "FGApproachController::render function not yet implemented" << endl; + std::cerr << "FGApproachController::render function not yet implemented" << std::endl; } diff --git a/src/Airports/groundnetwork.cxx b/src/Airports/groundnetwork.cxx index 7f82d2da2..bb66cfbb1 100644 --- a/src/Airports/groundnetwork.cxx +++ b/src/Airports/groundnetwork.cxx @@ -1140,7 +1140,6 @@ static void WorldCoordinate(osg::Matrix& obj_pos, double lat, void FGGroundNetwork::render(bool visible) { - SGMaterialLib *matlib = globals->get_matlib(); if (group) { //int nr = ; @@ -1163,7 +1162,8 @@ void FGGroundNetwork::render(bool visible) //for ( FGTaxiSegmentVectorIterator i = segments.begin(); i != segments.end(); i++) { //double dx = 0; for (TrafficVectorIterator i = activeTraffic.begin(); i != activeTraffic.end(); i++) { - // Handle start point + // Handle start point i.e. the segment that is connected to the aircraft itself on the starting end + // and to the the first "real" taxi segment on the other end. int pos = i->getCurrentPosition() - 1; if (pos >= 0) { @@ -1178,7 +1178,7 @@ void FGGroundNetwork::render(bool visible) double coveredDistance = length * 0.5; SGGeod center; SGGeodesy::direct(start, heading, coveredDistance, center, az2); - //cerr << "Active Aircraft : Centerpoint = (" << center.getLatitudeDeg() << ", " << center.getLongitudeDeg() << "). Heading = " << heading << endl; + //std::cerr << "Active Aircraft : Centerpoint = (" << center.getLatitudeDeg() << ", " << center.getLongitudeDeg() << "). Heading = " << heading << std::endl; /////////////////////////////////////////////////////////////////////////////// // Make a helper function out of this osg::Matrix obj_pos; @@ -1242,8 +1242,9 @@ void FGGroundNetwork::render(bool visible) group->addChild( obj_trans ); ///////////////////////////////////////////////////////////////////// } else { - //cerr << "BIG FAT WARNING: current position is here : " << pos << endl; + //std::cerr << "BIG FAT WARNING: current position is here : " << pos << std::endl; } + // Next: Draw the other taxi segments. for (intVecIterator j = (i)->getIntentions().begin(); j != (i)->getIntentions().end(); j++) { osg::Matrix obj_pos; int k = (*j)-1; -- 2.39.5