mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
Flight plan fixes based on https://discordapp.com/channels/539048679160676382/539486309882789888/597133111272275970
* improved setting of combox value, fixed wrong text * do NOT emit signals when same index * getOwnCallsign * do NOT used cache FPs for own aircraft
This commit is contained in:
committed by
Mat Sutcliffe
parent
891a058f17
commit
ea7b3316c9
@@ -160,14 +160,17 @@ namespace BlackCore
|
||||
|
||||
// use cache, but not for own callsign (always reload)
|
||||
if (m_flightPlanCache.contains(callsign)) { plan = m_flightPlanCache[callsign]; }
|
||||
if (!plan.wasSentOrLoaded() || plan.timeDiffSentOrLoadedMs() > 30 * 1000)
|
||||
const bool ownAircraft = this->getOwnCallsign() == callsign;
|
||||
if (ownAircraft || !plan.wasSentOrLoaded() || plan.timeDiffSentOrLoadedMs() > 30 * 1000)
|
||||
{
|
||||
// outdated, or not in cache at all
|
||||
// outdated, or not in cache at all, or NOT own aircraft
|
||||
plan = CFlightPlan(); // reset
|
||||
m_flightPlanCache.remove(callsign);
|
||||
m_network->sendFlightPlanQuery(callsign);
|
||||
|
||||
// with this little trick we try to make an asynchronous signal / slot
|
||||
// based approach a synchronous return value
|
||||
const QTime waitForFlightPlan = QTime::currentTime().addMSecs(1000);
|
||||
const QTime waitForFlightPlan = QTime::currentTime().addMSecs(1500);
|
||||
while (sApp && QTime::currentTime() < waitForFlightPlan)
|
||||
{
|
||||
// process some other events and hope network answer is received already
|
||||
|
||||
Reference in New Issue
Block a user