From 943b1b8e7923aa93d1e9bb1961d520d98a4ed9a6 Mon Sep 17 00:00:00 2001 From: durk Date: Thu, 27 Jul 2006 14:49:41 +0000 Subject: [PATCH] Enable the airway database parsing. --- src/Airports/dynamics.cxx | 4 ++-- src/Main/fg_init.cxx | 10 ++++++++++ src/Main/globals.hxx | 6 ++++++ src/Traffic/SchedFlight.cxx | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Airports/dynamics.cxx b/src/Airports/dynamics.cxx index 721abc2bc..53902ac48 100644 --- a/src/Airports/dynamics.cxx +++ b/src/Airports/dynamics.cxx @@ -465,11 +465,11 @@ void FGAirportDynamics::getActiveRunway(const string &trafficType, int action, s RunwayGroup *currRunwayGroup = 0; int nrActiveRunways = 0; time_t dayStart = fgGetLong("/sim/time/utc/day-seconds"); - if (((dayStart - lastUpdate) > 600) || trafficType != prevTrafficType) + if ((fabs(dayStart - lastUpdate) > 600) || trafficType != prevTrafficType) { landing.clear(); takeoff.clear(); - //lastUpdate = dayStart; + lastUpdate = dayStart; prevTrafficType = trafficType; FGEnvironment diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 793b5921a..874288901 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -1085,6 +1085,16 @@ fgInitNav () fixlist->init( p_fix ); globals->set_fixlist( fixlist ); + SG_LOG(SG_GENERAL, SG_INFO, " Airways"); + SGPath p_awy( globals->get_fg_root() ); + p_awy.append( "Navaids/awy.dat" ); + FGAirwayNetwork *awyNet = new FGAirwayNetwork; + //cerr << "Loading Airways" << endl; + awyNet->load (p_awy ); + awyNet->init(); + //cerr << "initializing airways" << endl; + globals->set_airwaynet( awyNet ); + return true; } diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index e1cef63dd..1f0ff5500 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -73,6 +73,7 @@ class FGControls; class FGFlightPlanDispatcher; class FGIO; class FGNavList; +class FGAirwayNetwork; class FGTACANList; class FGFixList; class FGLight; @@ -210,6 +211,7 @@ private: FGNavList *carrierlist; FGTACANList *channellist; FGFixList *fixlist; + FGAirwayNetwork *airwaynet; //Mulitplayer managers FGMultiplayMgr *multiplayer_mgr; @@ -374,6 +376,10 @@ public: inline FGTACANList *get_channellist() const { return channellist; } inline void set_channellist( FGTACANList *c ) { channellist = c; } + inline FGAirwayNetwork *get_airwaynet() const { return airwaynet; } + inline void set_airwaynet( FGAirwayNetwork *a ) { airwaynet = a; } + + /** * Save the current state as the initial state. */ diff --git a/src/Traffic/SchedFlight.cxx b/src/Traffic/SchedFlight.cxx index dc44c53b6..731ee6b8f 100644 --- a/src/Traffic/SchedFlight.cxx +++ b/src/Traffic/SchedFlight.cxx @@ -174,6 +174,7 @@ time_t FGScheduledFlight::processTimeString(const string& theTime) { timeOffsetInDays = 0; } + // TODO: verify status of each token. targetHour = atoi(timeCopy.substr(0,2).c_str()); targetMinute = atoi(timeCopy.substr(3,5).c_str()); targetSecond = atoi(timeCopy.substr(6,8).c_str());