71std::map<std::string, std::string> FGScheduledFlight::missingAirports = std::map<std::string, std::string>();
85 fltRules{other.fltRules},
86 departurePort{other.departurePort},
87 arrivalPort{other.arrivalPort},
90 requiredAircraft{other.requiredAircraft},
91 departureTime{other.departureTime},
92 arrivalTime{other.arrivalTime},
93 repeatPeriod{other.repeatPeriod}
95 cruiseAltitude = other.cruiseAltitude;
96 initialized = other.initialized;
97 available = other.available;
174 int timeOffsetInDays = 0;
180 SGTime* currTimeDate =
globals->get_time_params();
182 string timeCopy = theTime;
188 const auto daySeparatorPos = timeCopy.find(
"/", 0);
189 if (daySeparatorPos != string::npos) {
190 const int weekday = std::stoi(timeCopy.substr(0, daySeparatorPos));
191 timeOffsetInDays = weekday - currTimeDate->getGmt()->tm_wday;
192 timeCopy = theTime.substr(daySeparatorPos + 1);
195 const auto timeTokens = simgear::strutils::split(timeCopy,
":");
196 if (timeTokens.size() != 3) {
197 SG_LOG(SG_AI, SG_DEV_WARN,
"FGScheduledFlight: Timestring too short. " << theTime <<
" Defaulted to now");
198 return currTimeDate->get_cur_time();
202 targetHour = std::stoi(timeTokens.at(0));
203 targetMinute = std::stoi(timeTokens.at(1));
204 targetSecond = std::stoi(timeTokens.at(2));
205 targetTimeDate.tm_year = currTimeDate->getGmt()->tm_year;
206 targetTimeDate.tm_mon = currTimeDate->getGmt()->tm_mon;
207 targetTimeDate.tm_mday = currTimeDate->getGmt()->tm_mday;
208 targetTimeDate.tm_hour = targetHour;
209 targetTimeDate.tm_min = targetMinute;
210 targetTimeDate.tm_sec = targetSecond;
212 time_t processedTime = sgTimeGetGMT(&targetTimeDate);
213 processedTime += timeOffsetInDays * 24 * 60 * 60;
214 if (processedTime < currTimeDate->get_cur_time()) {
215 processedTime += repeatPeriod;
222 return processedTime;
239 while ((arrivalTime < now) || (arrivalTime > now + repeatPeriod)) {
240 if (arrivalTime < now) {
241 departureTime += repeatPeriod;
242 arrivalTime += repeatPeriod;
243 SG_LOG(SG_AI, SG_BULK,
"Adjusted schedule forward : " << callsign <<
" " << now <<
" " << departureTime <<
" " << arrivalTime);
244 }
else if (arrivalTime > now + repeatPeriod) {
245 departureTime -= repeatPeriod;
246 arrivalTime -= repeatPeriod;
247 SG_LOG(SG_AI, SG_BULK,
"Adjusted schedule backward : " << callsign <<
" " << now <<
" " << departureTime <<
" " << arrivalTime);
249 SG_LOG(SG_AI, SG_BULK,
"Not Adjusted schedule : " << now);
290 if(departurePort ==
nullptr)
292 if (!FGScheduledFlight::missingAirports.count(depId)) {
293 FGScheduledFlight::missingAirports.insert(std::pair<std::string,std::string>(depId, depId));
294 SG_LOG( SG_AI, SG_DEBUG,
"Traffic manager could not find airport : " << depId);
299 if(arrivalPort ==
nullptr)
301 if (!FGScheduledFlight::missingAirports.count(arrId)) {
302 FGScheduledFlight::missingAirports.insert(std::pair<std::string,std::string>(arrId, arrId));
303 SG_LOG( SG_AI, SG_DEBUG,
"Traffic manager could not find airport : " << arrId);