Some preparatory work for reinstating a missing piece of code in the routing algorithm for the AI system.
This commit is contained in:
parent
1dc7d4cf11
commit
dbde1f2232
3 changed files with 17 additions and 10 deletions
src
|
@ -270,7 +270,7 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
|
||||||
if (node == -1) {
|
if (node == -1) {
|
||||||
node = park->guid();
|
node = park->guid();
|
||||||
} else if (node == 0) {
|
} else if (node == 0) {
|
||||||
// HAndle case where parking doens't have a node
|
// Handle case where parking doesn't have a node
|
||||||
if (firstFlight) {
|
if (firstFlight) {
|
||||||
node = park->guid();
|
node = park->guid();
|
||||||
} else {
|
} else {
|
||||||
|
@ -311,6 +311,10 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
|
||||||
// push each node on the taxi route as a waypoint
|
// push each node on the taxi route as a waypoint
|
||||||
// int route;
|
// int route;
|
||||||
//cerr << "Building taxi route" << endl;
|
//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)) {
|
while (taxiRoute.next(&node)) {
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
snprintf(buffer, 10, "%lld", (long long int) node);
|
snprintf(buffer, 10, "%lld", (long long int) node);
|
||||||
|
@ -319,7 +323,8 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
|
||||||
FGAIWaypoint *wpt =
|
FGAIWaypoint *wpt =
|
||||||
createOnGround(ac, buffer, tn->geod(), apt->getElevation(),
|
createOnGround(ac, buffer, tn->geod(), apt->getElevation(),
|
||||||
ac->getPerformance()->vTaxi());
|
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() << " ";
|
//cerr << "Nodes left " << taxiRoute->nodesLeft() << " ";
|
||||||
if (taxiRoute.nodesLeft() == 1) {
|
if (taxiRoute.nodesLeft() == 1) {
|
||||||
// Note that we actually have hold points in the ground network, but this is just an initial test.
|
// 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 =
|
FGAIWaypoint *wpt =
|
||||||
createOnGround(ac, buffer, tn->geod(), apt->getElevation(),
|
createOnGround(ac, buffer, tn->geod(), apt->getElevation(),
|
||||||
ac->getPerformance()->vTaxi());
|
ac->getPerformance()->vTaxi());
|
||||||
// wpt->setRouteIndex(route);
|
//TODO: find an alternative way to pass route information to the waypoint.
|
||||||
|
//wpt->setRouteIndex(route);
|
||||||
pushBackWaypoint(wpt);
|
pushBackWaypoint(wpt);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ FGATCInstruction FGTowerController::getInstruction(int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGTowerController::render(bool visible) {
|
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() {
|
string FGTowerController::getName() {
|
||||||
|
@ -1315,7 +1315,7 @@ static void WorldCoordinate(osg::Matrix& obj_pos, double lat,
|
||||||
|
|
||||||
void FGStartupController::render(bool visible)
|
void FGStartupController::render(bool visible)
|
||||||
{
|
{
|
||||||
|
//std::cerr << "Rendering startup controller" << std::endl;
|
||||||
SGMaterialLib *matlib = globals->get_matlib();
|
SGMaterialLib *matlib = globals->get_matlib();
|
||||||
if (group) {
|
if (group) {
|
||||||
//int nr = ;
|
//int nr = ;
|
||||||
|
@ -1716,7 +1716,7 @@ ActiveRunway *FGApproachController::getRunway(const string& name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGApproachController::render(bool visible) {
|
void FGApproachController::render(bool visible) {
|
||||||
//cerr << "FGApproachController::render function not yet implemented" << endl;
|
std::cerr << "FGApproachController::render function not yet implemented" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1140,7 +1140,6 @@ static void WorldCoordinate(osg::Matrix& obj_pos, double lat,
|
||||||
|
|
||||||
void FGGroundNetwork::render(bool visible)
|
void FGGroundNetwork::render(bool visible)
|
||||||
{
|
{
|
||||||
|
|
||||||
SGMaterialLib *matlib = globals->get_matlib();
|
SGMaterialLib *matlib = globals->get_matlib();
|
||||||
if (group) {
|
if (group) {
|
||||||
//int nr = ;
|
//int nr = ;
|
||||||
|
@ -1163,7 +1162,8 @@ void FGGroundNetwork::render(bool visible)
|
||||||
//for ( FGTaxiSegmentVectorIterator i = segments.begin(); i != segments.end(); i++) {
|
//for ( FGTaxiSegmentVectorIterator i = segments.begin(); i != segments.end(); i++) {
|
||||||
//double dx = 0;
|
//double dx = 0;
|
||||||
for (TrafficVectorIterator i = activeTraffic.begin(); i != activeTraffic.end(); i++) {
|
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;
|
int pos = i->getCurrentPosition() - 1;
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
|
|
||||||
|
@ -1178,7 +1178,7 @@ void FGGroundNetwork::render(bool visible)
|
||||||
double coveredDistance = length * 0.5;
|
double coveredDistance = length * 0.5;
|
||||||
SGGeod center;
|
SGGeod center;
|
||||||
SGGeodesy::direct(start, heading, coveredDistance, center, az2);
|
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
|
// Make a helper function out of this
|
||||||
osg::Matrix obj_pos;
|
osg::Matrix obj_pos;
|
||||||
|
@ -1242,8 +1242,9 @@ void FGGroundNetwork::render(bool visible)
|
||||||
group->addChild( obj_trans );
|
group->addChild( obj_trans );
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
} else {
|
} 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++) {
|
for (intVecIterator j = (i)->getIntentions().begin(); j != (i)->getIntentions().end(); j++) {
|
||||||
osg::Matrix obj_pos;
|
osg::Matrix obj_pos;
|
||||||
int k = (*j)-1;
|
int k = (*j)-1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue