From 3cdea0705dba6f316268a314175a411e30546d8b Mon Sep 17 00:00:00 2001 From: mfranz Date: Tue, 7 Feb 2006 22:35:22 +0000 Subject: [PATCH] emit to different message properties: /sim/messages/{atc,pilot,ai-plane,ground,approach} These can the be used for differenct screen.log colors and for different voices. (Aircraft & tutoruals may want to write to /sim/messages/copilot) --- src/ATC/AIPlane.cxx | 1 + src/ATC/ATC.cxx | 1 + src/ATC/ATCDialog.cxx | 4 +++- src/ATC/ATCdisplay.cxx | 2 -- src/ATC/approach.cxx | 21 ++++++++++++++------- src/ATC/approach.hxx | 2 ++ src/ATC/ground.cxx | 2 ++ 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/ATC/AIPlane.cxx b/src/ATC/AIPlane.cxx index a20bffcb3..3bcb4e548 100644 --- a/src/ATC/AIPlane.cxx +++ b/src/ATC/AIPlane.cxx @@ -182,6 +182,7 @@ void FGAIPlane::ProcessCallback(int code) { // The refname is a string to identify this sample to the sound manager // The repeating flag indicates whether the message should be repeated continuously or played once. void FGAIPlane::Render(const string& refname, bool repeating) { + fgSetString("/sim/messages/ai-plane", pending_transmission.c_str()); #ifdef ENABLE_AUDIO_SUPPORT voice = (voiceOK && fgGetBool("/sim/sound/voice")); if(voice) { diff --git a/src/ATC/ATC.cxx b/src/ATC/ATC.cxx index 1301a5425..973783aab 100644 --- a/src/ATC/ATC.cxx +++ b/src/ATC/ATC.cxx @@ -225,6 +225,7 @@ void FGATC::SetData(ATCData* d) { // The refname is a string to identify this sample to the sound manager // The repeating flag indicates whether the message should be repeated continuously or played once. void FGATC::Render(string& msg, const string& refname, bool repeating) { + fgSetString("/sim/messages/atc", msg.c_str()); #ifdef ENABLE_AUDIO_SUPPORT _voice = (_voiceOK && fgGetBool("/sim/sound/voice")); if(_voice) { diff --git a/src/ATC/ATCDialog.cxx b/src/ATC/ATCDialog.cxx index b54679d5c..d24b1b024 100644 --- a/src/ATC/ATCDialog.cxx +++ b/src/ATC/ATCDialog.cxx @@ -268,8 +268,10 @@ void FGATCDialog::PopupCallback(int num) { //cout << "Doing callback...\n"; ATCMenuEntry a = atcmlist[num]; atcptr->SetFreqInUse(); + string pilot = atcptr->GenText(a.transmission, a.callback_code); + fgSetString("/sim/messages/pilot", pilot.c_str()); // This is the user's speech getting displayed. - globals->get_ATC_display()->RegisterSingleMessage(atcptr->GenText(a.transmission, a.callback_code)); + globals->get_ATC_display()->RegisterSingleMessage(pilot); _callbackPending = true; _callbackTimer = 0.0; _callbackWait = 5.0; diff --git a/src/ATC/ATCdisplay.cxx b/src/ATC/ATCdisplay.cxx index 4d5fe9735..cd05ca4d0 100644 --- a/src/ATC/ATCdisplay.cxx +++ b/src/ATC/ATCdisplay.cxx @@ -215,14 +215,12 @@ void FGATCDisplay::RegisterSingleMessage(const string& msg, double delay) { m.dsp_offset = 0.0; msgList.push_back(m); - fgSetString("/sim/messages/atc", msg.c_str()); //cout << "Single message registered\n"; } void FGATCDisplay::RegisterRepeatingMessage(const string& msg) { rep_msg = true; rep_msg_str = msg; - fgSetString("/sim/messages/atc", msg.c_str()); return; } diff --git a/src/ATC/approach.cxx b/src/ATC/approach.cxx index 0d46355a3..110bf61b8 100644 --- a/src/ATC/approach.cxx +++ b/src/ATC/approach.cxx @@ -179,7 +179,7 @@ void FGApproach::Update(double dt) { tpars.alt = planes[i].aalt; message = current_transmissionlist->gen_text(station, code, tpars, true ); //cout << message << '\n'; - globals->get_ATC_display()->RegisterSingleMessage( message, 0 ); + set_message(message); planes[i].lmc = code; planes[i].tlm = etime_node->getDoubleValue(); planes[i].on_crs = true; @@ -237,8 +237,7 @@ void FGApproach::Update(double dt) { message = current_transmissionlist->gen_text(station, code, tpars, true ); //cout << "Approach transmitting...\n"; //cout << message << endl; - globals->get_ATC_display()->RegisterSingleMessage( message, 0 ); - + set_message(message); } else { code.c1 = 1; @@ -248,7 +247,7 @@ void FGApproach::Update(double dt) { message = current_transmissionlist->gen_text(station, code, tpars, true); //cout << "Approach transmitting 2 ...\n"; //cout << message << endl; - globals->get_ATC_display()->RegisterSingleMessage( message, 0 ); + set_message(message); } planes[i].lmc = code; planes[i].tlm = etime_node->getDoubleValue(); @@ -295,7 +294,7 @@ void FGApproach::Update(double dt) { message = current_transmissionlist->gen_text(station, code, tpars, true); //cout << "Approach transmitting 3 ...\n"; //cout << message << '\n'; - globals->get_ATC_display()->RegisterSingleMessage( message, 0 ); + set_message(message); planes[i].lmc = code; planes[i].tlm = etime_node->getDoubleValue(); } @@ -325,7 +324,7 @@ void FGApproach::Update(double dt) { message = current_transmissionlist->gen_text(station, code, tpars, true); //cout << "Approach transmitting 4 ...\n"; //cout << message << '\n'; - globals->get_ATC_display()->RegisterSingleMessage( message, 0 ); + set_message(message); planes[i].lmc = code; planes[i].tlm = etime_node->getDoubleValue(); @@ -352,7 +351,7 @@ void FGApproach::Update(double dt) { message = current_transmissionlist->gen_text(station, code, tpars, true); //cout << "Approach transmitting 5 ...\n"; //cout << message << '\n'; - globals->get_ATC_display()->RegisterSingleMessage( message, 0 ); + set_message(message); planes[i].lmc = code; planes[i].tlm = etime_node->getDoubleValue(); @@ -752,3 +751,11 @@ int FGApproach::RemovePlane() { return num_planes; } + + +void FGApproach::set_message(const string &msg) +{ + fgSetString("/sim/messages/approach", msg.c_str()); + globals->get_ATC_display()->RegisterSingleMessage( msg, 0 ); +} + diff --git a/src/ATC/approach.hxx b/src/ATC/approach.hxx index 282f0c4bd..9109e4521 100644 --- a/src/ATC/approach.hxx +++ b/src/ATC/approach.hxx @@ -176,6 +176,8 @@ private: double angle_diff_deg( const double &a1, const double &a2); + void set_message(const string &s); + // ======================================================================== // get point2 given starting point1 and course and distance // input: point1 = heading in degrees, distance diff --git a/src/ATC/ground.cxx b/src/ATC/ground.cxx index de018cae6..ebd172d23 100644 --- a/src/ATC/ground.cxx +++ b/src/ATC/ground.cxx @@ -320,6 +320,7 @@ void FGGround::Update(double dt) { // eg " taxi holding point G2 runway " trns += ConvertRwyNumToSpokenString(activeRwy); if(_display) { + fgSetString("/sim/messages/ground", trns.c_str()); globals->get_ATC_display()->RegisterSingleMessage(trns, 0); } g->planePtr->RegisterTransmission(1); // cleared to taxi @@ -338,6 +339,7 @@ void FGGround::Update(double dt) { sprintf(buf, "%.2f", f); trns += buf; if(_display) { + fgSetString("/sim/messages/ground", trns.c_str()); globals->get_ATC_display()->RegisterSingleMessage(trns, 0); } g->planePtr->RegisterTransmission(2); // contact tower -- 2.39.5