mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
refs #808, set internals object for FSX
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
#include "blackmisc/network/textmessage.h"
|
||||
#include "blackmisc/simulation/fscommon/bcdconversions.h"
|
||||
#include "blackmisc/simulation/fsx/simconnectutilities.h"
|
||||
#include "blackmisc/simulation/fsx/fsxsimulatorinternals.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
@@ -50,7 +49,6 @@ namespace BlackSimPlugin
|
||||
Q_ASSERT_X(ownAircraftProvider, Q_FUNC_INFO, "Missing provider");
|
||||
Q_ASSERT_X(remoteAircraftProvider, Q_FUNC_INFO, "Missing provider");
|
||||
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing global object");
|
||||
this->m_simulatorSetup = CFsxSimulatorInternals::getInitializedInternals();
|
||||
this->m_realityBubbleTimer.setInterval(20 * 1000);
|
||||
connect(&m_realityBubbleTimer, &QTimer::timeout, this, &CSimulatorFsx::ps_addAircraftCurrentlyOutOfBubble);
|
||||
|
||||
@@ -310,7 +308,12 @@ namespace BlackSimPlugin
|
||||
void CSimulatorFsx::setSimConnected()
|
||||
{
|
||||
m_simConnected = true;
|
||||
this->initInternalsObject();
|
||||
emitSimulatorCombinedStatus();
|
||||
|
||||
// Internals depends on sim data which take a while to be read
|
||||
// this is a trich and I re-init again after a while (which is not really expensive)
|
||||
QTimer::singleShot(1000, this, [this] { this->initInternalsObject(); });
|
||||
}
|
||||
|
||||
void CSimulatorFsx::onSimRunning()
|
||||
@@ -1037,6 +1040,18 @@ namespace BlackSimPlugin
|
||||
}
|
||||
}
|
||||
|
||||
void CSimulatorFsx::initInternalsObject()
|
||||
{
|
||||
CSimulatorFsCommon::initInternalsObject();
|
||||
CSimulatorInternals s = this->m_simulatorInternals;
|
||||
const QString fsxPath = CFsCommonUtil::fsxDirFromRegistry(); // can be empty for remote FSX
|
||||
if (!fsxPath.isEmpty()) { s.setSimulatorInstallationDirectory(fsxPath); }
|
||||
|
||||
s.setValue("fsx/simConnectCfgFilename", CSimConnectUtilities::getLocalSimConnectCfgFilename());
|
||||
s.setValue("fsx/simConnectVersion", this->m_simConnectVersion);
|
||||
this->m_simulatorInternals = s;
|
||||
}
|
||||
|
||||
void CSimulatorFsx::reset()
|
||||
{
|
||||
if (m_simconnectTimerId >= 0) { killTimer(m_simconnectTimerId); }
|
||||
|
||||
Reference in New Issue
Block a user