Some tweaks to the AI traffic scheduling algorithm. Remove the requirement for a home port, but keep planning until we are back at the original port of departure.
This commit is contained in:
parent
0fa556d36a
commit
67c604a722
1 changed files with 10 additions and 4 deletions
|
@ -321,7 +321,7 @@ bool FGAISchedule::createAIAircraft(FGScheduledFlight* flight, double speedKnots
|
||||||
mp_ai.append(modelPath);
|
mp_ai.append(modelPath);
|
||||||
|
|
||||||
if (!mp.exists() && !mp_ai.exists()) {
|
if (!mp.exists() && !mp_ai.exists()) {
|
||||||
SG_LOG(SG_INPUT, SG_WARN, "TrafficManager: Could not load model " << mp.str());
|
SG_LOG(SG_GENERAL, SG_WARN, "TrafficManager: Could not load model " << mp.str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,9 +371,11 @@ void FGAISchedule::setHeading()
|
||||||
|
|
||||||
void FGAISchedule::scheduleFlights()
|
void FGAISchedule::scheduleFlights()
|
||||||
{
|
{
|
||||||
|
string startingPort;
|
||||||
if (!flights.empty()) {
|
if (!flights.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// change back to bulk
|
||||||
SG_LOG(SG_GENERAL, SG_BULK, "Scheduling Flights for : " << modelPath << " " << registration << " " << homePort);
|
SG_LOG(SG_GENERAL, SG_BULK, "Scheduling Flights for : " << modelPath << " " << registration << " " << homePort);
|
||||||
FGScheduledFlight *flight = NULL;
|
FGScheduledFlight *flight = NULL;
|
||||||
do {
|
do {
|
||||||
|
@ -381,7 +383,11 @@ void FGAISchedule::scheduleFlights()
|
||||||
if (!flight) {
|
if (!flight) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (startingPort.empty()) {
|
||||||
|
startingPort = flight->getDepartureAirport()->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
currentDestination = flight->getArrivalAirport()->getId();
|
currentDestination = flight->getArrivalAirport()->getId();
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
string departurePort = flight->getDepartureAirport()->getId();
|
string departurePort = flight->getDepartureAirport()->getId();
|
||||||
|
@ -409,7 +415,7 @@ void FGAISchedule::scheduleFlights()
|
||||||
<< " " << arrT << ":");
|
<< " " << arrT << ":");
|
||||||
|
|
||||||
flights.push_back(flight);
|
flights.push_back(flight);
|
||||||
} while (1); //while (currentDestination != homePort);
|
} while (currentDestination != startingPort);
|
||||||
SG_LOG(SG_GENERAL, SG_BULK, " Done ");
|
SG_LOG(SG_GENERAL, SG_BULK, " Done ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +498,7 @@ FGScheduledFlight* FGAISchedule::findAvailableFlight (const string ¤tDesti
|
||||||
}
|
}
|
||||||
if (flights.size()) {
|
if (flights.size()) {
|
||||||
time_t arrival = flights.back()->getArrivalTime();
|
time_t arrival = flights.back()->getArrivalTime();
|
||||||
if ((*i)->getDepartureTime() < arrival)
|
if ((*i)->getDepartureTime() < (arrival+(20*60)))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue