Issue #17 Fix aircraft labels setting not being updated in xswiftbus

Also related tidying up.
This commit is contained in:
Mat Sutcliffe
2020-08-13 14:32:06 +01:00
parent f114171083
commit e710c777ab
5 changed files with 5 additions and 35 deletions

View File

@@ -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<void*>(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<void*>(this));
}

View File

@@ -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)

View File

@@ -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];