]> git.mxchange.org Git - flightgear.git/commitdiff
Fix "Error in ground network. Failed to find first waypoint"
authorTorsten Dreyer <torsten@ŧ3r.de>
Tue, 21 Apr 2015 11:05:41 +0000 (13:05 +0200)
committerTorsten Dreyer <torsten@ŧ3r.de>
Tue, 21 Apr 2015 11:05:41 +0000 (13:05 +0200)
Fix provided by Jens Thoms Toerring, OK'ed from Durk
http://thread.gmane.org/gmane.games.flightgear.devel/77674

src/AIModel/AIFlightPlanCreate.cxx

index 9ec77c2c38e56f6c2be1ab4e84966701585ed35f..676cb4cc93f31a6c4db6bc14a46a4fa19cc644b1 100644 (file)
@@ -247,7 +247,6 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
         return true;
     }
 
-    intVec ids;
     PositionedID runwayId = 0;
     if (gn->getVersion() > 0) {
         runwayId = gn->findNearestNodeOnRunway(runwayTakeoff);
@@ -280,8 +279,9 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
         }
     }
     
-    FGTaxiRoute taxiRoute = gn->findShortestRoute(node, runwayId);
-    intVecIterator i;
+       FGTaxiRoute taxiRoute;
+       if ( runwayId != 0 )
+               taxiRoute = gn->findShortestRoute(node, runwayId);
 
     if (taxiRoute.empty()) {
         createDefaultTakeoffTaxi(ac, apt, rwy);
@@ -383,7 +383,6 @@ bool FGAIFlightPlan::createLandingTaxi(FGAIAircraft * ac, FGAirport * apt,
         return true;
     }
 
-    intVec ids;
     PositionedID runwayId = 0;
     if (gn->getVersion() == 1) {
         runwayId = gn->findNearestNodeOnRunway(lastWptPos);
@@ -393,16 +392,10 @@ bool FGAIFlightPlan::createLandingTaxi(FGAIAircraft * ac, FGAirport * apt,
     //cerr << "Using network node " << runwayId << endl;
     // A negative gateId indicates an overflow parking, use a
     // fallback mechanism for this. 
-    // Starting from gate 0 is a bit of a hack...
-    //FGTaxiRoute route;
-  //  delete taxiRoute;
-   // taxiRoute = new FGTaxiRoute;
+    // Starting from gate 0 doesn't work, so don't try it
     FGTaxiRoute taxiRoute;
     if (gate.isValid())
         taxiRoute = gn->findShortestRoute(runwayId, gate.parking()->guid());
-    else
-        taxiRoute = gn->findShortestRoute(runwayId, 0);
-    intVecIterator i;
 
     if (taxiRoute.empty()) {
         createDefaultLandingTaxi(ac, apt);