Ref T423, force update if simulator was paused or interrupted before

* force full updates for some cycles "m_updateAllRemoteAircraftCycles"
* only use "emitSimulatorCombinedStatus" to emit changed simulator status
* renamed to "finishUpdateRemoteAircraftAndSetStatistics"
* override "forced" in "getInterpolationSetupConsolidated"

This addresses the issue that aircraft appear below ground after moving the aircraft
This commit is contained in:
Klaus Basan
2018-11-02 18:15:04 +01:00
parent 4d7ca00324
commit 2b8e388ba1
8 changed files with 52 additions and 33 deletions

View File

@@ -182,8 +182,10 @@ namespace BlackSimPlugin
{
Q_UNUSED(event);
// remark: in FS9 there is no central updateRemoteAircraft() function, each FS9 client updates itself
if (m_clientStatus == Disconnected) { return; }
const CInterpolationAndRenderingSetupPerCallsign setup = this->simulator()->getInterpolationSetupConsolidated(m_callsign);
const bool forceFullUpdate = false;
const CInterpolationAndRenderingSetupPerCallsign setup = this->simulator()->getInterpolationSetupConsolidated(m_callsign, forceFullUpdate);
const CInterpolationResult result = m_interpolator.getInterpolation(QDateTime::currentMSecsSinceEpoch(), setup, 0);
// Test only for successful position. FS9 requires constant positions

View File

@@ -14,11 +14,12 @@
#include "multiplayerpackets.h"
#include "multiplayerpacketparser.h"
#include "registermetadata.h"
#include "../fscommon/simulatorfscommonfunctions.h"
#include "blackmisc/network/textmessage.h"
#include "blackmisc/simulation/fscommon/fscommonutil.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/propertyindexallclasses.h"
#include "blackmisc/simulation/fscommon/fscommonutil.h"
#include <QTimer>
#include <algorithm>
@@ -111,10 +112,10 @@ namespace BlackSimPlugin
m_fs9Host(fs9Host),
m_lobbyClient(lobbyClient)
{
//! \fixme KB 7/2017 change or remove when reviewed Could we just use: connect(lobbyClient.data(), &CLobbyClient::disconnected, this, &CSimulatorFs9::disconnectFrom);
//! \fixme KB 7/2017 change or remove comment when reviewed Could we just use: connect(lobbyClient.data(), &CLobbyClient::disconnected, this, &CSimulatorFs9::disconnectFrom);
connect(lobbyClient.data(), &CLobbyClient::disconnected, this, [ = ]
{
emit this->simulatorStatusChanged(ISimulator::Disconnected);
this->emitSimulatorCombinedStatus();
});
this->setDefaultModel(
@@ -164,7 +165,7 @@ namespace BlackSimPlugin
bool CSimulatorFs9::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
{
CCallsign callsign = newRemoteAircraft.getCallsign();
const CCallsign callsign = newRemoteAircraft.getCallsign();
if (m_hashFs9Clients.contains(callsign))
{
// already exists, remove first
@@ -447,7 +448,7 @@ namespace BlackSimPlugin
if (m_fs9Host->getHostAddress().isEmpty()) { return false; } // host not yet set up
if (canLobbyConnect)
{
if (m_isConnecting || m_lobbyClient->connectFs9ToHost(m_fs9Host->getHostAddress()) == S_OK)
if (m_isConnecting || isOk(m_lobbyClient->connectFs9ToHost(m_fs9Host->getHostAddress())))
{
m_isConnecting = true;
CLogMessage(this).info("swift is joining FS9 to the multiplayer session...");

View File

@@ -84,6 +84,9 @@ namespace BlackSimPlugin
virtual void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid) override;
//! @}
// remark: in FS9 there is no central updateRemoteAircraft() function, each FS9 client updates itself
// updateRemoteAircraft()
private:
//! Dispatch FSUIPC reading
//! \remark very frequently called