From db08e409e07575d98442c62e594212446e92a6b6 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 5 Jun 2014 13:37:36 +0200 Subject: [PATCH] refs #220, fixed issue with voice room resolution (not required for changed position / situation), some refactoring --- src/blackcore/context_ownaircraft_impl.cpp | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/blackcore/context_ownaircraft_impl.cpp b/src/blackcore/context_ownaircraft_impl.cpp index 60f40f592..725cbb864 100644 --- a/src/blackcore/context_ownaircraft_impl.cpp +++ b/src/blackcore/context_ownaircraft_impl.cpp @@ -74,20 +74,14 @@ namespace BlackCore if (this->m_voiceRoom1UrlOverride.isEmpty() && this->m_voiceRoom2UrlOverride.isEmpty() && !this->m_automaticVoiceRoomResolution) return; if (!this->getIContextNetwork()) return; // no chance to resolve rooms if (!this->getIContextAudio()) return; // no place to set rooms + if (!this->m_automaticVoiceRoomResolution) return; // not responsible CVoiceRoomList rooms; - if (this->m_automaticVoiceRoomResolution) - { - // requires correct frequencies set - // but local network uses exactly this object here, so if frequencies are set here, - // they are for network context as well - rooms = this->getIContextNetwork()->getSelectedVoiceRooms(); - } - else - { - rooms.push_back(CVoiceRoom()); - rooms.push_back(CVoiceRoom()); - } + + // requires correct frequencies set + // but local network uses exactly this object here, so if frequencies are set here, + // they are for network context as well + rooms = this->getIContextNetwork()->getSelectedVoiceRooms(); if (!this->m_voiceRoom1UrlOverride.isEmpty()) rooms[0] = CVoiceRoom(this->m_voiceRoom1UrlOverride); if (!this->m_voiceRoom2UrlOverride.isEmpty()) rooms[1] = CVoiceRoom(this->m_voiceRoom2UrlOverride); @@ -105,10 +99,10 @@ namespace BlackCore // trigger the correct signals bool changedCockpit = this->updateOwnCockpit(aircraft.getCom1System(), aircraft.getCom2System(), aircraft.getTransponder(), originator); - bool changedPosition = this->updateOwnPosition(aircraft.getPosition(), aircraft.getAltitude() , originator); - bool changedSituation = this->updateOwnSituation(aircraft.getSituation(), originator); + this->updateOwnPosition(aircraft.getPosition(), aircraft.getAltitude() , originator); + this->updateOwnSituation(aircraft.getSituation(), originator); - if (changedCockpit || changedPosition || changedSituation) this->resolveVoiceRooms(); + if (changedCockpit) this->resolveVoiceRooms(); // all the rest this->m_ownAircraft = aircraft;