#endif
#include <cstdlib>
+#include <cstdio>
#include <simgear/math/sg_geodesy.hxx>
-#include <Airports/simple.hxx>
+#include <Airports/airport.hxx>
#include <Airports/runways.hxx>
#include <Airports/dynamics.hxx>
+#include <Airports/groundnetwork.hxx>
#include <Environment/environment_mgr.hxx>
#include <Environment/environment.hxx>
#include "AIAircraft.hxx"
#include "performancedata.hxx"
+using std::string;
// TODO: Use James Turner's createOnGround functions.
bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
double vTaxi = ac->getPerformance()->vTaxi();
double vTaxiBackward = vTaxi * (-2.0/3.0);
double vTaxiReduced = vTaxi * (2.0/3.0);
+
// Active runway can be conditionally set by ATC, so at the start of a new flight, this
// must be reset.
activeRunway.clear();
- if (!(dep->getDynamics()->getGroundNetwork()->exists())) {
+ if (!(dep->getDynamics()->getGroundController()->exists())) {
//cerr << "Push Back fallback" << endl;
createPushBackFallBack(ac, firstFlight, dep,
radius, fltType, aircraftType, airline);
FGGroundNetwork* groundNet = dep->getDynamics()->getGroundNetwork();
FGParking *parking = gate.parking();
if (parking && parking->getPushBackPoint() > 0) {
- FGTaxiRoute route = groundNet->findShortestRoute(parking->guid(), parking->getPushBackPoint(), false);
+ FGTaxiRoute route = groundNet->findShortestRoute(parking, parking->getPushBackPoint(), false);
int size = route.size();
if (size < 2) {
}
route.first();
- PositionedID node, previous= 0;
+ FGTaxiNodeRef node;
+ int rte;
- while (route.next(&node))
+ while (route.next(node, &rte))
{
char buffer[10];
- snprintf (buffer, 10, "%lld", node);
- FGTaxiNode *tn = groundNet->findNode(node);
- FGAIWaypoint *wpt = createOnGround(ac, string(buffer), tn->geod(), dep->getElevation(), vTaxiBackward);
-
+ snprintf (buffer, 10, "%d", node->getIndex());
+ FGAIWaypoint *wpt = createOnGround(ac, string(buffer), node->geod(), dep->getElevation(), vTaxiBackward);
+
+ /*
if (previous) {
FGTaxiSegment* segment = groundNet->findSegment(previous, node);
wpt->setRouteIndex(segment->getIndex());
// not on the route yet, make up a unique segment ID
int x = (int) tn->guid();
wpt->setRouteIndex(x);
- }
-
+ }*/
+
+ wpt->setRouteIndex(rte);
pushBackWaypoint(wpt);
- previous = node;
+ //previous = node;
}
// some special considerations for the last point:
waypoints.back()->setName(string("PushBackPoint"));
ac->setTaxiClearanceRequest(false);
double az2 = 0.0;
- FGTaxiSegment* pushForwardSegment = dep->getDynamics()->getGroundNetwork()->findSegment(parking->guid(), 0);
+ FGTaxiSegment* pushForwardSegment = dep->getDynamics()->getGroundNetwork()->findSegment(parking, 0);
// there aren't any routes for this parking.
if (!pushForwardSegment) {
SG_LOG(SG_AI, SG_ALERT, "Gate " << parking->ident() << "doesn't seem to have routes associated with it.");
return false;
}
- lastNodeVisited = pushForwardSegment->getEnd()->getIndex();
+ lastNodeVisited = pushForwardSegment->getEnd();
double distance = pushForwardSegment->getLength();
double parkingHeading = parking->getHeading();