diff --git a/src/plugins/simulator/xplane/xswiftbustrafficproxy.cpp b/src/plugins/simulator/xplane/xswiftbustrafficproxy.cpp index b73bdf741..b26babe7f 100644 --- a/src/plugins/simulator/xplane/xswiftbustrafficproxy.cpp +++ b/src/plugins/simulator/xplane/xswiftbustrafficproxy.cpp @@ -84,16 +84,6 @@ namespace BlackSimPlugin m_dbusInterface->callDBus(QLatin1String("setDefaultIcao"), defaultIcao); } - void CXSwiftBusTrafficProxy::setDrawingLabels(bool drawing) - { - m_dbusInterface->callDBus(QLatin1String("setDrawingLabels"), drawing); - } - - bool CXSwiftBusTrafficProxy::isDrawingLabels() const - { - return m_dbusInterface->callDBusRet(QLatin1String("isDrawingLabels")); - } - void CXSwiftBusTrafficProxy::setMaxPlanes(int planes) { m_dbusInterface->callDBus(QLatin1String("setMaxPlanes"), planes); diff --git a/src/plugins/simulator/xplane/xswiftbustrafficproxy.h b/src/plugins/simulator/xplane/xswiftbustrafficproxy.h index 39d07a02d..1e9667ec5 100644 --- a/src/plugins/simulator/xplane/xswiftbustrafficproxy.h +++ b/src/plugins/simulator/xplane/xswiftbustrafficproxy.h @@ -213,12 +213,6 @@ namespace BlackSimPlugin //! \copydoc XSwiftBus::CTraffic::setDefaultIcao void setDefaultIcao(const QString &defaultIcao); - //! \copydoc XSwiftBus::CTraffic::setDrawingLabels - void setDrawingLabels(bool drawing); - - //! \copydoc XSwiftBus::CTraffic::isDrawingLabels - bool isDrawingLabels() const; - //! \copydoc XSwiftBus::CTraffic::setMaxPlanes void setMaxPlanes(int planes); diff --git a/src/xswiftbus/drawable.h b/src/xswiftbus/drawable.h index 33fc00803..969f22bf1 100644 --- a/src/xswiftbus/drawable.h +++ b/src/xswiftbus/drawable.h @@ -34,6 +34,7 @@ namespace XSwiftBus //! Register the draw callback. void show() { + if (m_visible) { return; } m_visible = true; XPLMRegisterDrawCallback(callback, m_phase, m_before, static_cast(this)); } @@ -41,6 +42,7 @@ namespace XSwiftBus //! Unregister the draw callback. void hide() { + if (!m_visible) { return; } m_visible = false; XPLMUnregisterDrawCallback(callback, m_phase, m_before, static_cast(this)); } diff --git a/src/xswiftbus/settings.h b/src/xswiftbus/settings.h index b9690cdc1..406286ea1 100644 --- a/src/xswiftbus/settings.h +++ b/src/xswiftbus/settings.h @@ -36,10 +36,12 @@ namespace XSwiftBus public: //! Get settings //! \threadsafe + //! \fixme Does this really need to be threadsafe? CSettings getSettings() const; //! Set settings //! \threadsafe + //! \fixme Does this really need to be threadsafe? void setSettings(const CSettings &settings); //! Get settings from xswiftbus.conf (needed during plugin initialization) diff --git a/src/xswiftbus/traffic.cpp b/src/xswiftbus/traffic.cpp index 0431dd4bb..b9bb4d05b 100644 --- a/src/xswiftbus/traffic.cpp +++ b/src/xswiftbus/traffic.cpp @@ -605,24 +605,6 @@ namespace XSwiftBus setDefaultIcao(defaultIcao); }); } - else if (message.getMethodName() == "setDrawingLabels") - { - maybeSendEmptyDBusReply(wantsReply, sender, serial); - bool drawing = true; - message.beginArgumentRead(); - message.getArgument(drawing); - queueDBusCall([ = ]() - { - setDrawingLabels(drawing); - }); - } - else if (message.getMethodName() == "isDrawingLabels") - { - queueDBusCall([ = ]() - { - sendDBusReply(sender, serial, isDrawingLabels()); - }); - } else if (message.getMethodName() == "setMaxPlanes") { maybeSendEmptyDBusReply(wantsReply, sender, serial); @@ -844,6 +826,7 @@ namespace XSwiftBus { invokeQueuedDBusCalls(); doPlaneUpdates(); + setDrawingLabels(getSettings().isDrawingLabels()); emitSimFrame(); m_countFrame++; return 1; @@ -876,7 +859,6 @@ namespace XSwiftBus void CTraffic::interpolatePosition(Plane *plane) { std::memcpy(&plane->positions[3], &plane->positions[2], sizeof(plane->positions[2])); - return; const auto now = std::chrono::steady_clock::now(); const auto t1 = plane->positionTimes[2] - plane->positionTimes[0];