From 41d11b7efe60a2c01d914c407c9be129ed79e731 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Tue, 4 Aug 2020 16:12:58 +0100 Subject: [PATCH] Fix #67 by unregistering XPMP2's flight loop callback and instead calling it from within our own flight loop callback --- src/xswiftbus/traffic.cpp | 7 +++++++ src/xswiftbus/xplanemp2 | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/xswiftbus/traffic.cpp b/src/xswiftbus/traffic.cpp index 3185c2d6f..2f437e782 100644 --- a/src/xswiftbus/traffic.cpp +++ b/src/xswiftbus/traffic.cpp @@ -30,6 +30,8 @@ // clazy:excludeall=reserve-candidates +float XPMP_PrepListHook(float, float, int, void *); // defined in xplanemp2/src/Renderer.cpp + using namespace BlackMisc::Simulation::XPlane::QtFreeUtils; namespace XSwiftBus @@ -107,6 +109,9 @@ namespace XSwiftBus else { m_enabledMultiplayer = true; + + // we will call xplanemp's callback from within our own callback + XPLMUnregisterFlightLoopCallback(XPMP_PrepListHook, nullptr); } } @@ -819,6 +824,8 @@ namespace XSwiftBus m_updates.push_back({ plane->id, &plane->position, &plane->surfaces, &plane->surveillance }); } XPMPUpdatePlanes(m_updates.data(), sizeof(XPMPUpdate_t), m_updates.size()); + + XPMP_PrepListHook(0, 0, 0, nullptr); } void CTraffic::interpolateGear(Plane* plane) diff --git a/src/xswiftbus/xplanemp2 b/src/xswiftbus/xplanemp2 index 71b339f88..b1dd0c845 160000 --- a/src/xswiftbus/xplanemp2 +++ b/src/xswiftbus/xplanemp2 @@ -1 +1 @@ -Subproject commit 71b339f88c1f1675d9e71a0754e17d7d44afe65a +Subproject commit b1dd0c84581750a5258903f536ff94383347bd87