diff --git a/src/xswiftbus/traffic.cpp b/src/xswiftbus/traffic.cpp index cccf45cb1..29499533e 100644 --- a/src/xswiftbus/traffic.cpp +++ b/src/xswiftbus/traffic.cpp @@ -255,7 +255,13 @@ namespace XSwiftBus void CTraffic::setDrawingLabels(bool drawing) { - s_settingsProvider->getSettings().setDrawingLabels(drawing); + CSettings s = this->getSettings(); + if (s.isDrawingLabels() != drawing) + { + s.setDrawingLabels(drawing); + this->setSettings(s); + } + if (drawing) { XPMPEnableAircraftLabels(); @@ -954,6 +960,17 @@ namespace XSwiftBus traffic->emitSimFrame(); } + traffic->m_countFrame++; + if (traffic->m_countFrame % 250 == 0) + { + // update labels + const CSettings s = traffic->getSettings(); + if (traffic->isDrawingLabels() != s.isDrawingLabels()) + { + traffic->setDrawingLabels(s.isDrawingLabels()); + } + } + return 1; } diff --git a/src/xswiftbus/traffic.h b/src/xswiftbus/traffic.h index 53ab687c0..c28d9737c 100644 --- a/src/xswiftbus/traffic.h +++ b/src/xswiftbus/traffic.h @@ -210,6 +210,7 @@ namespace XSwiftBus DeltaCameraPosition m_deltaCameraPosition; bool m_emitSimFrame = true; + int m_countFrame = 0; //!< allows to do something every n-th frame int getPlaneData(void *id, int dataType, void *io_data); static int getPlaneData(void *id, int dataType, void *io_data, void *self)