1
0
Fork 0

A missing call to initializeAirports() restored; this now works. Add documentation to atcdialog.

This commit is contained in:
legoboyvdlp R 2019-08-07 15:37:30 +01:00 committed by James Turner
parent c789687da0
commit 0132ddf7a1
3 changed files with 15 additions and 6 deletions

View file

@ -273,6 +273,7 @@ void FGATCManager::update ( double time ) {
if (destination != result && result != "") { if (destination != result && result != "") {
destination = result; destination = result;
userAircraftScheduledFlight->setArrivalAirport(destination); userAircraftScheduledFlight->setArrivalAirport(destination);
userAircraftScheduledFlight->initializeAirports();
userAircraftTrafficRef->clearAllFlights(); userAircraftTrafficRef->clearAllFlights();
userAircraftTrafficRef->assign(userAircraftScheduledFlight.get()); userAircraftTrafficRef->assign(userAircraftScheduledFlight.get());

View file

@ -57,6 +57,7 @@ static SGPropertyNode *getNamedNode(SGPropertyNode *prop, const char *name)
return 0; return 0;
} }
// help function to make a string all uppercase
static void atcUppercase(string &s) { static void atcUppercase(string &s) {
for(unsigned int i=0; i<s.size(); ++i) { for(unsigned int i=0; i<s.size(); ++i) {
s[i] = toupper(s[i]); s[i] = toupper(s[i]);
@ -184,20 +185,23 @@ static bool doFrequencyDisplay( const SGPropertyNode* args, SGPropertyNode * roo
return true; return true;
} }
// Initialize instance variable to NULL - first instance not yet generated
// first call to instance() will create a new instance, therafter return that instance
FGATCDialogNew * FGATCDialogNew::_instance = NULL; FGATCDialogNew * FGATCDialogNew::_instance = NULL;
// Constructor function, assign values
FGATCDialogNew::FGATCDialogNew() FGATCDialogNew::FGATCDialogNew()
: _gui(NULL), : _gui(NULL),
dialogVisible(true) dialogVisible(true)
{ {
} }
// Destructor
FGATCDialogNew::~FGATCDialogNew() FGATCDialogNew::~FGATCDialogNew()
{ {
} }
// Init function, sets up instance of FGATCDialogNew on first call of instance()
void FGATCDialogNew::init() { void FGATCDialogNew::init() {
// Add ATC-dialog to the command list // Add ATC-dialog to the command list
globals->get_commands()->addCommand("ATC-dialog", FGATCDialogNew::popup ); globals->get_commands()->addCommand("ATC-dialog", FGATCDialogNew::popup );
@ -210,8 +214,6 @@ void FGATCDialogNew::init() {
globals->get_props()->setIntValue("/sim/atc/transmission-num", -1); globals->get_props()->setIntValue("/sim/atc/transmission-num", -1);
} }
// Display the ATC popup dialog box with options relevant to the users current situation. // Display the ATC popup dialog box with options relevant to the users current situation.
// //
// So, the first thing we need to do is check the frequency that our pilot's nav radio // So, the first thing we need to do is check the frequency that our pilot's nav radio
@ -224,7 +226,9 @@ void FGATCDialogNew::init() {
void FGATCDialogNew::addEntry(int nr, const std::string& txt) { void FGATCDialogNew::addEntry(int nr, const std::string& txt) {
commands.clear(); commands.clear();
// Append the text to the string list
commands.push_back(txt); commands.push_back(txt);
// Always will show this option
commands.push_back(string("Toggle ground network visibility")); commands.push_back(string("Toggle ground network visibility"));
} }
@ -232,8 +236,7 @@ void FGATCDialogNew::removeEntry(int nr) {
commands.clear(); commands.clear();
} }
// toggle state of dialogVisible
void FGATCDialogNew::PopupDialog() { void FGATCDialogNew::PopupDialog() {
dialogVisible = !dialogVisible; dialogVisible = !dialogVisible;
return; return;
@ -246,6 +249,8 @@ void FGATCDialogNew::update(double dt) {
// fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz"); // fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz");
const char *dialog_name = "atc-dialog"; const char *dialog_name = "atc-dialog";
// check gui subsystem
_gui = (NewGUI *)globals->get_subsystem("gui"); _gui = (NewGUI *)globals->get_subsystem("gui");
if (!_gui) { if (!_gui) {
return; return;

View file

@ -63,6 +63,9 @@ public:
return true; return true;
} }
// Generate new instance of FGATCDialogNew if it hasn't yet been generated
// Call constructor and init() functions
// If it has been generated, will return that instance
inline static FGATCDialogNew * instance() { inline static FGATCDialogNew * instance() {
if( _instance != NULL ) return _instance; if( _instance != NULL ) return _instance;
_instance = new FGATCDialogNew(); _instance = new FGATCDialogNew();