mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 01:35:45 +08:00
Ref T197, simulator info
* CSimulatorInfo only initialized once and not over and over again in plugin info * getSimulatorInfo() no longer virtual, as we can access the member CSimulatorInfo directly * display exact simualtor in FSX/P3D driver * renamed to identifierToSimulator and fixed typo "Identifier"
This commit is contained in:
@@ -32,9 +32,9 @@ namespace BlackCore
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimulatorInfo ISimulator::getSimulatorInfo() const
|
const CSimulatorInfo &ISimulator::getSimulatorInfo() const
|
||||||
{
|
{
|
||||||
return CSimulatorInfo(this->getSimulatorPluginInfo().getSimulatorInfo());
|
return this->getSimulatorPluginInfo().getSimulatorInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISimulator::registerHelp()
|
void ISimulator::registerHelp()
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace BlackCore
|
|||||||
virtual const BlackMisc::Simulation::CSimulatorPluginInfo &getSimulatorPluginInfo() const = 0;
|
virtual const BlackMisc::Simulation::CSimulatorPluginInfo &getSimulatorPluginInfo() const = 0;
|
||||||
|
|
||||||
//! Get simulator info (default implementation)
|
//! Get simulator info (default implementation)
|
||||||
virtual BlackMisc::Simulation::CSimulatorInfo getSimulatorInfo() const;
|
const BlackMisc::Simulation::CSimulatorInfo &getSimulatorInfo() const;
|
||||||
|
|
||||||
//! Get the setup (simulator environemnt)
|
//! Get the setup (simulator environemnt)
|
||||||
virtual const BlackMisc::Simulation::CSimulatorInternals &getSimulatorInternals() const = 0;
|
virtual const BlackMisc::Simulation::CSimulatorInternals &getSimulatorInternals() const = 0;
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ namespace BlackGui
|
|||||||
QStringList ids;
|
QStringList ids;
|
||||||
|
|
||||||
// have to match full canonical ids from swift-plugin-simulators.xml
|
// have to match full canonical ids from swift-plugin-simulators.xml
|
||||||
if (ui->cb_FS9->isChecked()) { ids << CSimulatorPluginInfo::fs9PluginIndentifier(); }
|
if (ui->cb_FS9->isChecked()) { ids << CSimulatorPluginInfo::fs9PluginIdentifier(); }
|
||||||
if (ui->cb_FSX->isChecked()) { ids << CSimulatorPluginInfo::fsxPluginIndentifier(); }
|
if (ui->cb_FSX->isChecked()) { ids << CSimulatorPluginInfo::fsxPluginIdentifier(); }
|
||||||
if (ui->cb_P3D->isChecked()) { ids << CSimulatorPluginInfo::p3dPluginIndentifier(); }
|
if (ui->cb_P3D->isChecked()) { ids << CSimulatorPluginInfo::p3dPluginIdentifier(); }
|
||||||
if (ui->cb_XP->isChecked()) { ids << CSimulatorPluginInfo::xplanePluginIndentifier(); }
|
if (ui->cb_XP->isChecked()) { ids << CSimulatorPluginInfo::xplanePluginIdentifier(); }
|
||||||
|
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ namespace BlackMisc
|
|||||||
CSimulatorInfo::CSimulatorInfo()
|
CSimulatorInfo::CSimulatorInfo()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
CSimulatorInfo::CSimulatorInfo(const QString &identifierString) : m_simulator(identifierToFlag(identifierString))
|
CSimulatorInfo::CSimulatorInfo(const QString &identifierString) : m_simulator(identifierToSimulator(identifierString))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
CSimulatorInfo::CSimulatorInfo(const QStringList &simulators)
|
CSimulatorInfo::CSimulatorInfo(const QStringList &simulators)
|
||||||
{
|
{
|
||||||
const QString identifier = simulators.join(' ');
|
const QString identifier = simulators.join(' ');
|
||||||
m_simulator = identifierToFlag(identifier);
|
m_simulator = identifierToSimulator(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimulatorInfo::CSimulatorInfo(Simulator simulator) : m_simulator(static_cast<int>(simulator))
|
CSimulatorInfo::CSimulatorInfo(Simulator simulator) : m_simulator(static_cast<int>(simulator))
|
||||||
@@ -181,10 +181,10 @@ namespace BlackMisc
|
|||||||
static const QString e;
|
static const QString e;
|
||||||
if (!this->isSingleSimulator()) { return e; }
|
if (!this->isSingleSimulator()) { return e; }
|
||||||
const Simulator s = getSimulator();
|
const Simulator s = getSimulator();
|
||||||
if (s.testFlag(FSX)) { return CSimulatorPluginInfo::fsxPluginIndentifier(); }
|
if (s.testFlag(FSX)) { return CSimulatorPluginInfo::fsxPluginIdentifier(); }
|
||||||
if (s.testFlag(FS9)) { return CSimulatorPluginInfo::fs9PluginIndentifier(); }
|
if (s.testFlag(FS9)) { return CSimulatorPluginInfo::fs9PluginIdentifier(); }
|
||||||
if (s.testFlag(P3D)) { return CSimulatorPluginInfo::p3dPluginIndentifier(); }
|
if (s.testFlag(P3D)) { return CSimulatorPluginInfo::p3dPluginIdentifier(); }
|
||||||
if (s.testFlag(XPLANE)) { return CSimulatorPluginInfo::xplanePluginIndentifier(); }
|
if (s.testFlag(XPLANE)) { return CSimulatorPluginInfo::xplanePluginIdentifier(); }
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,9 +197,9 @@ namespace BlackMisc
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimulatorInfo::Simulator CSimulatorInfo::identifierToFlag(const QString &identifier)
|
CSimulatorInfo::Simulator CSimulatorInfo::identifierToSimulator(const QString &identifier)
|
||||||
{
|
{
|
||||||
QString i(identifier.toLower().trimmed().remove(' ').remove('-'));
|
const QString i(identifier.toLower().trimmed().remove(' ').remove('-'));
|
||||||
if (i.isEmpty()) { return None; }
|
if (i.isEmpty()) { return None; }
|
||||||
|
|
||||||
Simulator s = None;
|
Simulator s = None;
|
||||||
|
|||||||
@@ -31,14 +31,16 @@ namespace BlackMisc
|
|||||||
namespace Simulation
|
namespace Simulation
|
||||||
{
|
{
|
||||||
//! Simple hardcoded info about the corresponding simulator.
|
//! Simple hardcoded info about the corresponding simulator.
|
||||||
|
//!
|
||||||
//! * in an ideal world this class would not exist, all would depend on flexible plugins \sa CSimulatorPluginInfo
|
//! * in an ideal world this class would not exist, all would depend on flexible plugins \sa CSimulatorPluginInfo
|
||||||
//! * in a real world the info is needed in a couple of places to specify the simulator
|
//! * in a real world the info is needed in a couple of places to specify the simulator
|
||||||
//! ** when data from the swift datastore are read, the corresponding simulator is specified
|
//! ** when data from the swift datastore are read, the corresponding simulator is specified
|
||||||
//! ** when model metadata are written to the swift datastore the DB simulator info needs to be provided
|
//! ** when model metadata are written to the swift datastore the DB simulator info needs to be provided
|
||||||
//! ** when models are indexed from disk it does not know the corresponding driver
|
//! ** when models are indexed from disk it does not know the corresponding driver
|
||||||
//! ** also there is no strict dependency of some functions to the driver. I might not have the XP plugin installed,
|
//! ** also there is no strict dependency of some functions to the driver. I might not have the XP plugin installed,
|
||||||
//! but need to handle XP data from the swift data store
|
//! but need to handle XP data from the swift datastore.
|
||||||
//! If someone manages to remove this hardocded simulator information and makes it entirely flexible
|
//!
|
||||||
|
//! If someone manages to remove this hardcoded simulator information and makes it entirely flexible
|
||||||
//! based upon the plugin metadata feel free.
|
//! based upon the plugin metadata feel free.
|
||||||
class BLACKMISC_EXPORT CSimulatorInfo : public CValueObject<CSimulatorInfo>
|
class BLACKMISC_EXPORT CSimulatorInfo : public CValueObject<CSimulatorInfo>
|
||||||
{
|
{
|
||||||
@@ -163,7 +165,7 @@ namespace BlackMisc
|
|||||||
static Simulator boolToFlag(bool fsx, bool fs9, bool xp, bool p3d);
|
static Simulator boolToFlag(bool fsx, bool fs9, bool xp, bool p3d);
|
||||||
|
|
||||||
//! Identifer, as provided by plugin
|
//! Identifer, as provided by plugin
|
||||||
static Simulator identifierToFlag(const QString &identifier);
|
static Simulator identifierToSimulator(const QString &identifier);
|
||||||
|
|
||||||
//! All simulators
|
//! All simulators
|
||||||
static const CSimulatorInfo &allSimulators();
|
static const CSimulatorInfo &allSimulators();
|
||||||
|
|||||||
@@ -19,8 +19,10 @@ namespace BlackMisc
|
|||||||
namespace Simulation
|
namespace Simulation
|
||||||
{
|
{
|
||||||
CSimulatorPluginInfo::CSimulatorPluginInfo(const QString &identifier, const QString &name, const QString &simulator, const QString &description, bool valid) :
|
CSimulatorPluginInfo::CSimulatorPluginInfo(const QString &identifier, const QString &name, const QString &simulator, const QString &description, bool valid) :
|
||||||
m_identifier(identifier), m_name(name), m_simulator(simulator), m_description(description), m_valid(valid)
|
m_identifier(identifier), m_name(name), m_simulator(simulator), m_description(description), m_info(simulator), m_valid(valid)
|
||||||
{ }
|
{
|
||||||
|
Q_ASSERT_X(m_info.isSingleSimulator(), Q_FUNC_INFO, "need single simulator");
|
||||||
|
}
|
||||||
|
|
||||||
void CSimulatorPluginInfo::convertFromJson(const QJsonObject &json)
|
void CSimulatorPluginInfo::convertFromJson(const QJsonObject &json)
|
||||||
{
|
{
|
||||||
@@ -38,6 +40,12 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
CValueObject::convertFromJson(json);
|
CValueObject::convertFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set info if it wasn't set already
|
||||||
|
if (m_info.isNoSimulator() && !m_simulator.isEmpty())
|
||||||
|
{
|
||||||
|
m_info = CSimulatorInfo(m_simulator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorPluginInfo::isUnspecified() const
|
bool CSimulatorPluginInfo::isUnspecified() const
|
||||||
@@ -45,14 +53,9 @@ namespace BlackMisc
|
|||||||
return m_identifier.isEmpty();
|
return m_identifier.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimulatorInfo CSimulatorPluginInfo::getSimulatorInfo() const
|
|
||||||
{
|
|
||||||
return CSimulatorInfo(getSimulator());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimulatorPluginInfo::isEmulatedPlugin() const
|
bool CSimulatorPluginInfo::isEmulatedPlugin() const
|
||||||
{
|
{
|
||||||
return this->getIdentifier() == emulatedPluginIndentifier();
|
return this->getIdentifier() == emulatedPluginIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CSimulatorPluginInfo::convertToQString(bool i18n) const
|
QString CSimulatorPluginInfo::convertToQString(bool i18n) const
|
||||||
@@ -61,31 +64,31 @@ namespace BlackMisc
|
|||||||
return QString("%1 (%2)").arg(m_name, m_identifier);
|
return QString("%1 (%2)").arg(m_name, m_identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CSimulatorPluginInfo::fsxPluginIndentifier()
|
const QString &CSimulatorPluginInfo::fsxPluginIdentifier()
|
||||||
{
|
{
|
||||||
static const QString s("org.swift-project.plugins.simulator.fsx");
|
static const QString s("org.swift-project.plugins.simulator.fsx");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CSimulatorPluginInfo::p3dPluginIndentifier()
|
const QString &CSimulatorPluginInfo::p3dPluginIdentifier()
|
||||||
{
|
{
|
||||||
static const QString s("org.swift-project.plugins.simulator.p3d");
|
static const QString s("org.swift-project.plugins.simulator.p3d");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CSimulatorPluginInfo::fs9PluginIndentifier()
|
const QString &CSimulatorPluginInfo::fs9PluginIdentifier()
|
||||||
{
|
{
|
||||||
static const QString s("org.swift-project.plugins.simulator.fs9");
|
static const QString s("org.swift-project.plugins.simulator.fs9");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CSimulatorPluginInfo::xplanePluginIndentifier()
|
const QString &CSimulatorPluginInfo::xplanePluginIdentifier()
|
||||||
{
|
{
|
||||||
static const QString s("org.swift-project.plugins.simulator.xplane");
|
static const QString s("org.swift-project.plugins.simulator.xplane");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CSimulatorPluginInfo::emulatedPluginIndentifier()
|
const QString &CSimulatorPluginInfo::emulatedPluginIdentifier()
|
||||||
{
|
{
|
||||||
static const QString s("org.swift-project.plugins.simulator.emulated");
|
static const QString s("org.swift-project.plugins.simulator.emulated");
|
||||||
return s;
|
return s;
|
||||||
@@ -95,11 +98,11 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
static const QStringList identifiers(
|
static const QStringList identifiers(
|
||||||
{
|
{
|
||||||
fsxPluginIndentifier(),
|
fsxPluginIdentifier(),
|
||||||
p3dPluginIndentifier(),
|
p3dPluginIdentifier(),
|
||||||
xplanePluginIndentifier(),
|
xplanePluginIdentifier(),
|
||||||
fs9PluginIndentifier(),
|
fs9PluginIdentifier(),
|
||||||
emulatedPluginIndentifier()
|
emulatedPluginIdentifier()
|
||||||
});
|
});
|
||||||
return identifiers;
|
return identifiers;
|
||||||
}
|
}
|
||||||
@@ -109,14 +112,14 @@ namespace BlackMisc
|
|||||||
if (BlackConfig::CBuildConfig::isRunningOnUnixPlatform())
|
if (BlackConfig::CBuildConfig::isRunningOnUnixPlatform())
|
||||||
{
|
{
|
||||||
// On UNIX we likely run XP
|
// On UNIX we likely run XP
|
||||||
return QStringList { xplanePluginIndentifier() };
|
return QStringList { xplanePluginIdentifier() };
|
||||||
}
|
}
|
||||||
|
|
||||||
return QStringList
|
return QStringList
|
||||||
{
|
{
|
||||||
fsxPluginIndentifier(),
|
fsxPluginIdentifier(),
|
||||||
p3dPluginIndentifier(),
|
p3dPluginIdentifier(),
|
||||||
xplanePluginIndentifier()
|
xplanePluginIdentifier()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace BlackMisc
|
|||||||
namespace Simulation
|
namespace Simulation
|
||||||
{
|
{
|
||||||
//! Describing a simulator plugin
|
//! Describing a simulator plugin
|
||||||
class BLACKMISC_EXPORT CSimulatorPluginInfo : public BlackMisc::CValueObject<CSimulatorPluginInfo>
|
class BLACKMISC_EXPORT CSimulatorPluginInfo : public CValueObject<CSimulatorPluginInfo>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
@@ -60,7 +60,7 @@ namespace BlackMisc
|
|||||||
const QString &getSimulator() const { return m_simulator; }
|
const QString &getSimulator() const { return m_simulator; }
|
||||||
|
|
||||||
//! Simulator info object
|
//! Simulator info object
|
||||||
BlackMisc::Simulation::CSimulatorInfo getSimulatorInfo() const;
|
const CSimulatorInfo &getSimulatorInfo() const { return m_info; }
|
||||||
|
|
||||||
//! Is this the emulated driver?
|
//! Is this the emulated driver?
|
||||||
bool isEmulatedPlugin() const;
|
bool isEmulatedPlugin() const;
|
||||||
@@ -72,19 +72,19 @@ namespace BlackMisc
|
|||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
//! Plugin identifier (FSX)
|
//! Plugin identifier (FSX)
|
||||||
static const QString &fsxPluginIndentifier();
|
static const QString &fsxPluginIdentifier();
|
||||||
|
|
||||||
//! Plugin identifier (P3D)
|
//! Plugin identifier (P3D)
|
||||||
static const QString &p3dPluginIndentifier();
|
static const QString &p3dPluginIdentifier();
|
||||||
|
|
||||||
//! Plugin identifier (FS9)
|
//! Plugin identifier (FS9)
|
||||||
static const QString &fs9PluginIndentifier();
|
static const QString &fs9PluginIdentifier();
|
||||||
|
|
||||||
//! Plugin identifier (XPlane)
|
//! Plugin identifier (XPlane)
|
||||||
static const QString &xplanePluginIndentifier();
|
static const QString &xplanePluginIdentifier();
|
||||||
|
|
||||||
//! Plugin identifier (emulated simulator plugin)
|
//! Plugin identifier (emulated simulator plugin)
|
||||||
static const QString &emulatedPluginIndentifier();
|
static const QString &emulatedPluginIdentifier();
|
||||||
|
|
||||||
//! All valid identifiers
|
//! All valid identifiers
|
||||||
static const QStringList &allIdentifiers();
|
static const QStringList &allIdentifiers();
|
||||||
@@ -97,6 +97,7 @@ namespace BlackMisc
|
|||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_simulator;
|
QString m_simulator;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
|
CSimulatorInfo m_info;
|
||||||
bool m_valid { false };
|
bool m_valid { false };
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
@@ -105,6 +106,7 @@ namespace BlackMisc
|
|||||||
BLACK_METAMEMBER(name, 0, DisabledForComparison | DisabledForHashing),
|
BLACK_METAMEMBER(name, 0, DisabledForComparison | DisabledForHashing),
|
||||||
BLACK_METAMEMBER(simulator, 0, DisabledForComparison | DisabledForHashing),
|
BLACK_METAMEMBER(simulator, 0, DisabledForComparison | DisabledForHashing),
|
||||||
BLACK_METAMEMBER(description, 0, DisabledForComparison | DisabledForHashing),
|
BLACK_METAMEMBER(description, 0, DisabledForComparison | DisabledForHashing),
|
||||||
|
BLACK_METAMEMBER(info, 0, DisabledForComparison | DisabledForHashing),
|
||||||
BLACK_METAMEMBER(valid, 0, DisabledForComparison | DisabledForHashing)
|
BLACK_METAMEMBER(valid, 0, DisabledForComparison | DisabledForHashing)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,12 +52,6 @@ namespace BlackSimPlugin
|
|||||||
this->connectOwnSignals();
|
this->connectOwnSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimulatorInfo CSimulatorEmulated::getSimulatorInfo() const
|
|
||||||
{
|
|
||||||
const CSwiftPluginSettings s = m_settings.get();
|
|
||||||
return s.getEmulatedSimulator();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimulatorEmulated::isTimeSynchronized() const
|
bool CSimulatorEmulated::isTimeSynchronized() const
|
||||||
{
|
{
|
||||||
return m_timeSyncronized;
|
return m_timeSyncronized;
|
||||||
|
|||||||
@@ -45,9 +45,6 @@ namespace BlackSimPlugin
|
|||||||
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider,
|
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
//! \copydoc BlackCore::CSimulatorCommon::getSimulatorInfo
|
|
||||||
virtual BlackMisc::Simulation::CSimulatorInfo getSimulatorInfo() const override;
|
|
||||||
|
|
||||||
// functions implemented
|
// functions implemented
|
||||||
virtual bool isTimeSynchronized() const override;
|
virtual bool isTimeSynchronized() const override;
|
||||||
virtual bool connectTo() override;
|
virtual bool connectTo() override;
|
||||||
|
|||||||
@@ -740,7 +740,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
const bool trace = parser.toBool(2);
|
const bool trace = parser.toBool(2);
|
||||||
this->setTraceSendId(trace);
|
this->setTraceSendId(trace);
|
||||||
CLogMessage(this, CLogCategory::cmdLine()).info("Tracing FSX/P3D driver sendIds is '%1'") << boolToOnOff(trace);
|
CLogMessage(this, CLogCategory::cmdLine()).info("Tracing %1 driver sendIds is '%2'") << this->getSimulatorPluginInfo().getIdentifier() << boolToOnOff(trace);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return CSimulatorFsCommon::parseDetails(parser);
|
return CSimulatorFsCommon::parseDetails(parser);
|
||||||
@@ -782,12 +782,12 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
// 2nd time, an error / avoid multiple messages
|
// 2nd time, an error / avoid multiple messages
|
||||||
// idea: if it happens once ignore
|
// idea: if it happens once ignore
|
||||||
CLogMessage(this).error("FSX/P3D: Dispatch error");
|
CLogMessage(this).error("%1: Dispatch error") << this->getSimulatorPluginInfo().getIdentifier();
|
||||||
}
|
}
|
||||||
else if (m_dispatchErrors > 5)
|
else if (m_dispatchErrors > 5)
|
||||||
{
|
{
|
||||||
// this normally happens during a FSX crash or shutdown
|
// this normally happens during a FSX crash or shutdown
|
||||||
CLogMessage(this).error("FSX/P3D: Multiple dispatch errors, disconnecting");
|
CLogMessage(this).error("%1: Multiple dispatch errors, disconnecting") << this->getSimulatorPluginInfo().getIdentifier();
|
||||||
this->disconnectFrom();
|
this->disconnectFrom();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -1709,14 +1709,13 @@ namespace BlackSimPlugin
|
|||||||
if (connectedSimName.isEmpty()) { return false; }
|
if (connectedSimName.isEmpty()) { return false; }
|
||||||
if (pluginSim.p3d())
|
if (pluginSim.p3d())
|
||||||
{
|
{
|
||||||
// P3D drivers only work with P3D
|
// P3D drivers only works with P3D
|
||||||
return connectedSimName.contains("lockheed") || connectedSimName.contains("martin") || connectedSimName.contains("p3d") || connectedSimName.contains("prepar");
|
return connectedSimName.contains("lockheed") || connectedSimName.contains("martin") || connectedSimName.contains("p3d") || connectedSimName.contains("prepar");
|
||||||
}
|
}
|
||||||
else if (pluginSim.fsx())
|
else if (pluginSim.fsx())
|
||||||
{
|
{
|
||||||
// FSX drivers works with P3D and FSX
|
// FSX drivers only works with FSX
|
||||||
return connectedSimName.contains("fsx") || connectedSimName.contains("microsoft") || connectedSimName.contains("simulator x") ||
|
return connectedSimName.contains("fsx") || connectedSimName.contains("microsoft") || connectedSimName.contains("simulator x");
|
||||||
connectedSimName.contains("lockheed") || connectedSimName.contains("martin") || connectedSimName.contains("p3d") || connectedSimName.contains("prepar");
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1741,7 +1740,7 @@ namespace BlackSimPlugin
|
|||||||
simListener->m_simConnectVersion = QString("%1.%2.%3.%4").arg(event->dwSimConnectVersionMajor).arg(event->dwSimConnectVersionMinor).arg(event->dwSimConnectBuildMajor).arg(event->dwSimConnectBuildMinor);
|
simListener->m_simConnectVersion = QString("%1.%2.%3.%4").arg(event->dwSimConnectVersionMajor).arg(event->dwSimConnectVersionMinor).arg(event->dwSimConnectBuildMajor).arg(event->dwSimConnectBuildMinor);
|
||||||
simListener->m_simulatorName = QString(event->szApplicationName);
|
simListener->m_simulatorName = QString(event->szApplicationName);
|
||||||
simListener->m_simulatorDetails = QString("Name: '%1' Version: %2 SimConnect: %3").arg(simListener->m_simulatorName, simListener->m_simulatorVersion, simListener->m_simConnectVersion);
|
simListener->m_simulatorDetails = QString("Name: '%1' Version: %2 SimConnect: %3").arg(simListener->m_simulatorName, simListener->m_simulatorVersion, simListener->m_simConnectVersion);
|
||||||
CLogMessage(static_cast<CSimulatorFsxCommonListener *>(nullptr)).info("Connect to FSX/P3D: '%1'") << simListener->backendInfo();
|
CLogMessage(static_cast<CSimulatorFsxCommonListener *>(nullptr)).info("Connect to %1: '%2'") << simListener->getPluginInfo().getIdentifier() << simListener->backendInfo();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_EXCEPTION:
|
case SIMCONNECT_RECV_ID_EXCEPTION:
|
||||||
|
|||||||
@@ -33,23 +33,23 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
void CALLBACK CSimulatorFsxCommon::SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext)
|
void CALLBACK CSimulatorFsxCommon::SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext)
|
||||||
{
|
{
|
||||||
CSimulatorFsxCommon *simulatorFsx = static_cast<CSimulatorFsxCommon *>(pContext);
|
CSimulatorFsxCommon *simulatorFsxP3D = static_cast<CSimulatorFsxCommon *>(pContext);
|
||||||
switch (pData->dwID)
|
switch (pData->dwID)
|
||||||
{
|
{
|
||||||
case SIMCONNECT_RECV_ID_OPEN:
|
case SIMCONNECT_RECV_ID_OPEN:
|
||||||
{
|
{
|
||||||
SIMCONNECT_RECV_OPEN *event = (SIMCONNECT_RECV_OPEN *)pData;
|
SIMCONNECT_RECV_OPEN *event = (SIMCONNECT_RECV_OPEN *)pData;
|
||||||
simulatorFsx->m_simulatorVersion = QString("%1.%2.%3.%4").arg(event->dwApplicationVersionMajor).arg(event->dwApplicationVersionMinor).arg(event->dwApplicationBuildMajor).arg(event->dwApplicationBuildMinor);
|
simulatorFsxP3D->m_simulatorVersion = QString("%1.%2.%3.%4").arg(event->dwApplicationVersionMajor).arg(event->dwApplicationVersionMinor).arg(event->dwApplicationBuildMajor).arg(event->dwApplicationBuildMinor);
|
||||||
simulatorFsx->m_simConnectVersion = QString("%1.%2.%3.%4").arg(event->dwSimConnectVersionMajor).arg(event->dwSimConnectVersionMinor).arg(event->dwSimConnectBuildMajor).arg(event->dwSimConnectBuildMinor);
|
simulatorFsxP3D->m_simConnectVersion = QString("%1.%2.%3.%4").arg(event->dwSimConnectVersionMajor).arg(event->dwSimConnectVersionMinor).arg(event->dwSimConnectBuildMajor).arg(event->dwSimConnectBuildMinor);
|
||||||
simulatorFsx->m_simulatorName = QString(event->szApplicationName);
|
simulatorFsxP3D->m_simulatorName = QString(event->szApplicationName);
|
||||||
simulatorFsx->m_simulatorDetails = QString("Name: '%1' Version: %2 SimConnect: %3").arg(simulatorFsx->m_simulatorName, simulatorFsx->m_simulatorVersion, simulatorFsx->m_simConnectVersion);
|
simulatorFsxP3D->m_simulatorDetails = QString("Name: '%1' Version: %2 SimConnect: %3").arg(simulatorFsxP3D->m_simulatorName, simulatorFsxP3D->m_simulatorVersion, simulatorFsxP3D->m_simConnectVersion);
|
||||||
CLogMessage(static_cast<CSimulatorFsxCommon *>(nullptr)).info("Connect to FSX/P3D: '%1'") << simulatorFsx->m_simulatorDetails;
|
CLogMessage(static_cast<CSimulatorFsxCommon *>(nullptr)).info("Connected to %1: '%2'") << simulatorFsxP3D->getSimulatorPluginInfo().getIdentifier() << simulatorFsxP3D->m_simulatorDetails;
|
||||||
simulatorFsx->setSimConnected();
|
simulatorFsxP3D->setSimConnected();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_EXCEPTION:
|
case SIMCONNECT_RECV_ID_EXCEPTION:
|
||||||
{
|
{
|
||||||
if (!simulatorFsx->stillDisplayReceiveExceptions()) { break; }
|
if (!simulatorFsxP3D->stillDisplayReceiveExceptions()) { break; }
|
||||||
SIMCONNECT_RECV_EXCEPTION *exception = (SIMCONNECT_RECV_EXCEPTION *)pData;
|
SIMCONNECT_RECV_EXCEPTION *exception = (SIMCONNECT_RECV_EXCEPTION *)pData;
|
||||||
const DWORD exceptionId = exception->dwException;
|
const DWORD exceptionId = exception->dwException;
|
||||||
const DWORD sendId = exception->dwSendID;
|
const DWORD sendId = exception->dwSendID;
|
||||||
@@ -64,15 +64,15 @@ namespace BlackSimPlugin
|
|||||||
QString ex;
|
QString ex;
|
||||||
ex.sprintf("Exception=%lu | SendID=%lu | Index=%lu | cbData=%lu", exceptionId, sendId, index, data);
|
ex.sprintf("Exception=%lu | SendID=%lu | Index=%lu | cbData=%lu", exceptionId, sendId, index, data);
|
||||||
const QString exceptionString(CSimConnectUtilities::simConnectExceptionToString((SIMCONNECT_EXCEPTION)exception->dwException));
|
const QString exceptionString(CSimConnectUtilities::simConnectExceptionToString((SIMCONNECT_EXCEPTION)exception->dwException));
|
||||||
const QString sendIdDetails = simulatorFsx->getSendIdTraceDetails(sendId);
|
const QString sendIdDetails = simulatorFsxP3D->getSendIdTraceDetails(sendId);
|
||||||
CLogMessage(simulatorFsx).warning("Caught simConnect exception: '%1' '%2' | send details: '%3'")
|
CLogMessage(simulatorFsxP3D).warning("Caught simConnect exception: '%1' '%2' | send details: '%3'")
|
||||||
<< exceptionString << ex
|
<< exceptionString << ex
|
||||||
<< (sendIdDetails.isEmpty() ? "N/A" : sendIdDetails);
|
<< (sendIdDetails.isEmpty() ? "N/A" : sendIdDetails);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_QUIT:
|
case SIMCONNECT_RECV_ID_QUIT:
|
||||||
{
|
{
|
||||||
simulatorFsx->onSimExit();
|
simulatorFsxP3D->onSimExit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_EVENT:
|
case SIMCONNECT_RECV_ID_EVENT:
|
||||||
@@ -85,21 +85,21 @@ namespace BlackSimPlugin
|
|||||||
const bool running = event->dwData ? true : false;
|
const bool running = event->dwData ? true : false;
|
||||||
if (running)
|
if (running)
|
||||||
{
|
{
|
||||||
simulatorFsx->onSimRunning();
|
simulatorFsxP3D->onSimRunning();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
simulatorFsx->onSimStopped();
|
simulatorFsxP3D->onSimStopped();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SystemEventPause:
|
case SystemEventPause:
|
||||||
{
|
{
|
||||||
const bool p = event->dwData ? true : false;
|
const bool p = event->dwData ? true : false;
|
||||||
if (simulatorFsx->m_simPaused != p)
|
if (simulatorFsxP3D->m_simPaused != p)
|
||||||
{
|
{
|
||||||
simulatorFsx->m_simPaused = p;
|
simulatorFsxP3D->m_simPaused = p;
|
||||||
simulatorFsx->emitSimulatorCombinedStatus();
|
simulatorFsxP3D->emitSimulatorCombinedStatus();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -120,14 +120,14 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
// such an object is not necessarily one of ours
|
// such an object is not necessarily one of ours
|
||||||
// for instance, I always see object "5" when I start the simulator
|
// for instance, I always see object "5" when I start the simulator
|
||||||
if (!simulatorFsx->getSimConnectObjects().isKnownSimObjectId(objectId)) { break; }
|
if (!simulatorFsxP3D->getSimConnectObjects().isKnownSimObjectId(objectId)) { break; }
|
||||||
switch (event->uEventID)
|
switch (event->uEventID)
|
||||||
{
|
{
|
||||||
case SystemEventObjectAdded:
|
case SystemEventObjectAdded:
|
||||||
// added in SIMCONNECT_RECV_ID_ASSIGNED_OBJECT_ID
|
// added in SIMCONNECT_RECV_ID_ASSIGNED_OBJECT_ID
|
||||||
break;
|
break;
|
||||||
case SystemEventObjectRemoved:
|
case SystemEventObjectRemoved:
|
||||||
simulatorFsx->simulatorReportedObjectRemoved(objectId);
|
simulatorFsxP3D->simulatorReportedObjectRemoved(objectId);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -141,7 +141,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
case SystemEventFrame:
|
case SystemEventFrame:
|
||||||
// doing interpolation
|
// doing interpolation
|
||||||
simulatorFsx->onSimFrame();
|
simulatorFsxP3D->onSimFrame();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -153,16 +153,16 @@ namespace BlackSimPlugin
|
|||||||
const SIMCONNECT_RECV_ASSIGNED_OBJECT_ID *event = static_cast<SIMCONNECT_RECV_ASSIGNED_OBJECT_ID *>(pData);
|
const SIMCONNECT_RECV_ASSIGNED_OBJECT_ID *event = static_cast<SIMCONNECT_RECV_ASSIGNED_OBJECT_ID *>(pData);
|
||||||
const DWORD requestId = event->dwRequestID;
|
const DWORD requestId = event->dwRequestID;
|
||||||
const DWORD objectId = event->dwObjectID;
|
const DWORD objectId = event->dwObjectID;
|
||||||
bool success = simulatorFsx->setSimConnectObjectId(requestId, objectId);
|
bool success = simulatorFsxP3D->setSimConnectObjectId(requestId, objectId);
|
||||||
if (!success) { break; } // not an request ID of ours
|
if (!success) { break; } // not an request ID of ours
|
||||||
|
|
||||||
success = simulatorFsx->simulatorReportedObjectAdded(objectId); // trigger follow up actions
|
success = simulatorFsxP3D->simulatorReportedObjectAdded(objectId); // trigger follow up actions
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
const CSimulatedAircraft remoteAircraft(simulatorFsx->getSimConnectObjects().getSimObjectForObjectId(objectId).getAircraft());
|
const CSimulatedAircraft remoteAircraft(simulatorFsxP3D->getSimConnectObjects().getSimObjectForObjectId(objectId).getAircraft());
|
||||||
const CStatusMessage msg = CStatusMessage(simulatorFsx).error("Cannot add object %1, cs: '%2' model: '%3'") << objectId << remoteAircraft.getCallsignAsString() << remoteAircraft.getModelString();
|
const CStatusMessage msg = CStatusMessage(simulatorFsxP3D).error("Cannot add object %1, cs: '%2' model: '%3'") << objectId << remoteAircraft.getCallsignAsString() << remoteAircraft.getModelString();
|
||||||
CLogMessage::preformatted(msg);
|
CLogMessage::preformatted(msg);
|
||||||
emit simulatorFsx->physicallyAddingRemoteModelFailed(remoteAircraft, msg);
|
emit simulatorFsxP3D->physicallyAddingRemoteModelFailed(remoteAircraft, msg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
static_assert(sizeof(DataDefinitionOwnAircraft) == 30 * sizeof(double), "DataDefinitionOwnAircraft has an incorrect size.");
|
static_assert(sizeof(DataDefinitionOwnAircraft) == 30 * sizeof(double), "DataDefinitionOwnAircraft has an incorrect size.");
|
||||||
const DataDefinitionOwnAircraft *ownAircaft = (DataDefinitionOwnAircraft *)&pObjData->dwData;
|
const DataDefinitionOwnAircraft *ownAircaft = (DataDefinitionOwnAircraft *)&pObjData->dwData;
|
||||||
simulatorFsx->updateOwnAircraftFromSimulator(*ownAircaft);
|
simulatorFsxP3D->updateOwnAircraftFromSimulator(*ownAircaft);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CSimConnectDefinitions::RequestOwnAircraftTitle:
|
case CSimConnectDefinitions::RequestOwnAircraftTitle:
|
||||||
@@ -190,13 +190,13 @@ namespace BlackSimPlugin
|
|||||||
CAircraftModel model;
|
CAircraftModel model;
|
||||||
model.setModelString(dataDefinitionModel->title);
|
model.setModelString(dataDefinitionModel->title);
|
||||||
model.setModelType(CAircraftModel::TypeOwnSimulatorModel);
|
model.setModelType(CAircraftModel::TypeOwnSimulatorModel);
|
||||||
simulatorFsx->reverseLookupAndUpdateOwnAircraftModel(model);
|
simulatorFsxP3D->reverseLookupAndUpdateOwnAircraftModel(model);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CSimConnectDefinitions::RequestSimEnvironment:
|
case CSimConnectDefinitions::RequestSimEnvironment:
|
||||||
{
|
{
|
||||||
const DataDefinitionSimEnvironment *simEnv = (DataDefinitionSimEnvironment *) &pObjData->dwData;
|
const DataDefinitionSimEnvironment *simEnv = (DataDefinitionSimEnvironment *) &pObjData->dwData;
|
||||||
if (simulatorFsx->isTimeSynchronized())
|
if (simulatorFsxP3D->isTimeSynchronized())
|
||||||
{
|
{
|
||||||
const int zh = simEnv->zuluTimeSeconds / 3600;
|
const int zh = simEnv->zuluTimeSeconds / 3600;
|
||||||
const int zm = (simEnv->zuluTimeSeconds - (zh * 3600)) / 60;
|
const int zm = (simEnv->zuluTimeSeconds - (zh * 3600)) / 60;
|
||||||
@@ -204,7 +204,7 @@ namespace BlackSimPlugin
|
|||||||
const int lh = simEnv->localTimeSeconds / 3600;
|
const int lh = simEnv->localTimeSeconds / 3600;
|
||||||
const int lm = (simEnv->localTimeSeconds - (lh * 3600)) / 60;
|
const int lm = (simEnv->localTimeSeconds - (lh * 3600)) / 60;
|
||||||
const CTime local(lh, lm);
|
const CTime local(lh, lm);
|
||||||
simulatorFsx->synchronizeTime(zulu, local);
|
simulatorFsxP3D->synchronizeTime(zulu, local);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -214,19 +214,19 @@ namespace BlackSimPlugin
|
|||||||
if (CSimulatorFsxCommon::isRequestForSimData(requestId))
|
if (CSimulatorFsxCommon::isRequestForSimData(requestId))
|
||||||
{
|
{
|
||||||
static_assert(sizeof(DataDefinitionRemoteAircraftSimData) == 5 * sizeof(double), "DataDefinitionRemoteAircraftSimData has an incorrect size.");
|
static_assert(sizeof(DataDefinitionRemoteAircraftSimData) == 5 * sizeof(double), "DataDefinitionRemoteAircraftSimData has an incorrect size.");
|
||||||
const CSimConnectObject simObj = simulatorFsx->getSimConnectObjects().getSimObjectForObjectId(objectId);
|
const CSimConnectObject simObj = simulatorFsxP3D->getSimConnectObjects().getSimObjectForObjectId(objectId);
|
||||||
if (!simObj.hasValidRequestAndObjectId()) break;
|
if (!simObj.hasValidRequestAndObjectId()) break;
|
||||||
const DataDefinitionRemoteAircraftSimData *remoteAircraftSimData = (DataDefinitionRemoteAircraftSimData *)&pObjData->dwData;
|
const DataDefinitionRemoteAircraftSimData *remoteAircraftSimData = (DataDefinitionRemoteAircraftSimData *)&pObjData->dwData;
|
||||||
// extra check, but ids should be the same
|
// extra check, but ids should be the same
|
||||||
if (objectId == simObj.getObjectId())
|
if (objectId == simObj.getObjectId())
|
||||||
{
|
{
|
||||||
simulatorFsx->updateRemoteAircraftFromSimulator(simObj, *remoteAircraftSimData);
|
simulatorFsxP3D->updateRemoteAircraftFromSimulator(simObj, *remoteAircraftSimData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CSimulatorFsxCommon::isRequestForLights(requestId))
|
else if (CSimulatorFsxCommon::isRequestForLights(requestId))
|
||||||
{
|
{
|
||||||
static_assert(sizeof(DataDefinitionRemoteAircraftLights) == 8 * sizeof(double), "DataDefinitionRemoteAircraftLights has an incorrect size.");
|
static_assert(sizeof(DataDefinitionRemoteAircraftLights) == 8 * sizeof(double), "DataDefinitionRemoteAircraftLights has an incorrect size.");
|
||||||
const CSimConnectObject simObj = simulatorFsx->getSimConnectObjects().getSimObjectForObjectId(objectId);
|
const CSimConnectObject simObj = simulatorFsxP3D->getSimConnectObjects().getSimObjectForObjectId(objectId);
|
||||||
if (!simObj.hasValidRequestAndObjectId()) break;
|
if (!simObj.hasValidRequestAndObjectId()) break;
|
||||||
const DataDefinitionRemoteAircraftLights *remoteAircraftLights = (DataDefinitionRemoteAircraftLights *)&pObjData->dwData;
|
const DataDefinitionRemoteAircraftLights *remoteAircraftLights = (DataDefinitionRemoteAircraftLights *)&pObjData->dwData;
|
||||||
// extra check, but ids should be the same
|
// extra check, but ids should be the same
|
||||||
@@ -234,11 +234,11 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
const CCallsign callsign(simObj.getCallsign());
|
const CCallsign callsign(simObj.getCallsign());
|
||||||
const CAircraftLights lights = remoteAircraftLights->toLights(); // as in simulator
|
const CAircraftLights lights = remoteAircraftLights->toLights(); // as in simulator
|
||||||
simulatorFsx->setCurrentLights(callsign, lights);
|
simulatorFsxP3D->setCurrentLights(callsign, lights);
|
||||||
if (simObj.getLightsAsSent().isNull())
|
if (simObj.getLightsAsSent().isNull())
|
||||||
{
|
{
|
||||||
// allows to compare for toggle
|
// allows to compare for toggle
|
||||||
simulatorFsx->setLightsAsSent(callsign, lights);
|
simulatorFsxP3D->setLightsAsSent(callsign, lights);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,7 @@ namespace BlackSimPlugin
|
|||||||
case SIMCONNECT_RECV_ID_AIRPORT_LIST:
|
case SIMCONNECT_RECV_ID_AIRPORT_LIST:
|
||||||
{
|
{
|
||||||
static const CLength maxDistance(200.0, CLengthUnit::NM());
|
static const CLength maxDistance(200.0, CLengthUnit::NM());
|
||||||
const CCoordinateGeodetic posAircraft(simulatorFsx->getOwnAircraftPosition());
|
const CCoordinateGeodetic posAircraft(simulatorFsxP3D->getOwnAircraftPosition());
|
||||||
const SIMCONNECT_RECV_AIRPORT_LIST *pAirportList = (SIMCONNECT_RECV_AIRPORT_LIST *) pData;
|
const SIMCONNECT_RECV_AIRPORT_LIST *pAirportList = (SIMCONNECT_RECV_AIRPORT_LIST *) pData;
|
||||||
for (unsigned i = 0; i < pAirportList->dwArraySize; ++i)
|
for (unsigned i = 0; i < pAirportList->dwArraySize; ++i)
|
||||||
{
|
{
|
||||||
@@ -265,26 +265,26 @@ namespace BlackSimPlugin
|
|||||||
CAirport airport(CAirportIcaoCode(icao), pos);
|
CAirport airport(CAirportIcaoCode(icao), pos);
|
||||||
const CLength d = airport.calculcateAndUpdateRelativeDistanceAndBearing(posAircraft);
|
const CLength d = airport.calculcateAndUpdateRelativeDistanceAndBearing(posAircraft);
|
||||||
if (d > maxDistance) { continue; }
|
if (d > maxDistance) { continue; }
|
||||||
airport.updateMissingParts(simulatorFsx->getWebServiceAirport(icao));
|
airport.updateMissingParts(simulatorFsxP3D->getWebServiceAirport(icao));
|
||||||
simulatorFsx->m_airportsInRangeFromSimulator.replaceOrAddByIcao(airport);
|
simulatorFsxP3D->m_airportsInRangeFromSimulator.replaceOrAddByIcao(airport);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simulatorFsx->m_airportsInRangeFromSimulator.size() > simulatorFsx->maxAirportsInRange())
|
if (simulatorFsxP3D->m_airportsInRangeFromSimulator.size() > simulatorFsxP3D->maxAirportsInRange())
|
||||||
{
|
{
|
||||||
simulatorFsx->m_airportsInRangeFromSimulator.sortByDistanceToOwnAircraft();
|
simulatorFsxP3D->m_airportsInRangeFromSimulator.sortByDistanceToOwnAircraft();
|
||||||
simulatorFsx->m_airportsInRangeFromSimulator.truncate(simulatorFsx->maxAirportsInRange());
|
simulatorFsxP3D->m_airportsInRangeFromSimulator.truncate(simulatorFsxP3D->maxAirportsInRange());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_CLIENT_DATA:
|
case SIMCONNECT_RECV_ID_CLIENT_DATA:
|
||||||
{
|
{
|
||||||
if (!simulatorFsx->m_useSbOffsets) { break; }
|
if (!simulatorFsxP3D->m_useSbOffsets) { break; }
|
||||||
const SIMCONNECT_RECV_CLIENT_DATA *clientData = (SIMCONNECT_RECV_CLIENT_DATA *)pData;
|
const SIMCONNECT_RECV_CLIENT_DATA *clientData = (SIMCONNECT_RECV_CLIENT_DATA *)pData;
|
||||||
if (simulatorFsx->m_useSbOffsets && clientData->dwRequestID == CSimConnectDefinitions::RequestSbData)
|
if (simulatorFsxP3D->m_useSbOffsets && clientData->dwRequestID == CSimConnectDefinitions::RequestSbData)
|
||||||
{
|
{
|
||||||
//! \fixme FSUIPC vs SimConnect why is offset 19 ident 2/0? In FSUIPC it is 0/1, according to documentation it is 0/1 but I receive 2/0 here. Whoever knows, add comment or fix if wrong
|
//! \fixme FSUIPC vs SimConnect why is offset 19 ident 2/0? In FSUIPC it is 0/1, according to documentation it is 0/1 but I receive 2/0 here. Whoever knows, add comment or fix if wrong
|
||||||
DataDefinitionClientAreaSb *sbData = (DataDefinitionClientAreaSb *) &clientData->dwData;
|
DataDefinitionClientAreaSb *sbData = (DataDefinitionClientAreaSb *) &clientData->dwData;
|
||||||
simulatorFsx->updateOwnAircraftFromSimulator(*sbData);
|
simulatorFsxP3D->updateOwnAircraftFromSimulator(*sbData);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user