#include STL_IOSTREAM
SG_USING_STD(cout);
-//#include <simgear/debug/logstream.hxx>
-//#include <simgear/misc/sgstream.hxx>
#include <simgear/misc/sg_path.hxx>
#ifdef FG_WEATHERCM
#include <Airports/runways.hxx>
#include "atis.hxx"
-#include "atislist.hxx"
+#include "commlist.hxx"
#include "ATCdisplay.hxx"
#include "ATCutils.hxx"
#include "ATCmgr.hxx"
-// Constructor
-FGATIS::FGATIS()
-: type(0),
-lon(0.0), lat(0.0),
-elev(0.0),
-x(0.0), y(0.0), z(0.0),
-freq(0),
-range(0),
-display(false),
-displaying(false),
-ident(""),
-name(""),
-transmission(""),
-trans_ident(""),
-atis_failed(false),
-refname("atis")
+FGATIS::FGATIS() :
+ transmission(""),
+ trans_ident(""),
+ atis_failed(false),
+ refname("atis")
+ //type(ATIS)
{
+ vPtr = globals->get_ATC_mgr()->GetVoicePointer(ATIS);
+ voiceOK = (vPtr == NULL ? false : true);
+ _type = ATIS;
}
-// Destructor
FGATIS::~FGATIS() {
}
// Main update function - checks whether we are displaying or not the correct message.
-void FGATIS::Update() {
- if(display) {
- if(displaying) {
+void FGATIS::Update(double dt) {
+ if(_display) {
+ if(_displaying) {
// Check if we need to update the message
// - basically every hour and if the weather changes significantly at the station
//globals->get_ATC_display()->ChangeRepeatingMessage(transmission);
// We need to get and display the message
UpdateTransmission();
//cout << "ATIS.CXX - calling ATCMgr to render transmission..." << endl;
- globals->get_ATC_mgr()->Render(transmission, refname, true);
- displaying = true;
+ Render(transmission, refname, true);
+ _displaying = true;
}
} else {
// We shouldn't be displaying
- if(displaying) {
+ if(_displaying) {
//cout << "ATIS.CXX - calling NoRender()..." << endl;
- globals->get_ATC_mgr()->NoRender(refname);
- displaying = false;
+ NoRender(refname);
+ _displaying = false;
}
}
}
FGPhysicalProperty stationweather = WeatherDatabase->get(position);
#else
FGEnvironment stationweather =
- globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
+ ((FGEnvironmentMgr *)globals->get_subsystem("environment"))
+ ->getEnvironment(lat, lon, elev);
#endif
transmission = "";
hours = atoi((time_str.substr(1,2)).c_str()); //Warning - this is fragile if the
//time string format changes
//cout << "In atis.cxx, hours = " << hours << endl;
- phonetic_id = current_atislist->GetCallSign(ident, hours, 0);
+ phonetic_id = current_commlist->GetCallSign(ident, hours, 0);
phonetic_id_string = GetPhoneticIdent(phonetic_id);
transmission += " ";
transmission += phonetic_id_string;
// Based on the airport-id and wind get the active runway
//FGRunway *r;
- SGPath path( globals->get_fg_root() );
- path.append( "Airports" );
- path.append( "runways.mk4" );
- FGRunways runways( path.c_str() );
-
+
#ifdef FG_WEATHERCM
//Set the heading to into the wind
double wind_x = stationweather.Wind[0];
double speed = stationweather.get_wind_speed_kt();
double hdg = stationweather.get_wind_from_heading_deg();
if (speed == 0) {
+ hdg = 270; // This forces West-facing rwys to be used in no-wind situations
+ // which is consistent with Flightgear's initial setup.
transmission += " / Winds_light_and_variable";
} else {
// FIXME: get gust factor in somehow
}
#endif
- string rwy_no = runways.search(ident, int(hdg));
- if(rwy_no != (string)"NN") {
+ string rwy_no = globals->get_runways()->search(ident, int(hdg));
+ if(rwy_no != "NN") {
transmission += " / Landing_and_departing_runway ";
transmission += ConvertRwyNumToSpokenString(atoi(rwy_no.c_str()));
//cout << "in atis.cxx, r.rwy_no = " << rwy_no << " r.id = " << r->id << " r.heading = " << r->heading << endl;