mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 15:25:34 +08:00
[FS9] Function for at least halfway correct engine type
This commit is contained in:
committed by
Mat Sutcliffe
parent
1ab1e8ca70
commit
a3f646a792
@@ -385,6 +385,14 @@ namespace BlackMisc
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QChar CAircraftIcaoCode::getAircraftTypeChar() const
|
||||||
|
{
|
||||||
|
if (m_combinedType.length() < 1) { return {}; }
|
||||||
|
QChar c(m_combinedType.at(0));
|
||||||
|
if (c == "-") { return {}; }
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
QString CAircraftIcaoCode::getCombinedModelDescription() const
|
QString CAircraftIcaoCode::getCombinedModelDescription() const
|
||||||
{
|
{
|
||||||
// Shortcut for most cases
|
// Shortcut for most cases
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ namespace BlackMisc
|
|||||||
//! Aircraft type, such a L(andplane), S(eaplane), H(elicopter)
|
//! Aircraft type, such a L(andplane), S(eaplane), H(elicopter)
|
||||||
QString getAircraftType() const;
|
QString getAircraftType() const;
|
||||||
|
|
||||||
|
//! Aircraft type, such a L(andplane), S(eaplane), H(elicopter)
|
||||||
|
QChar getAircraftTypeChar() const;
|
||||||
|
|
||||||
//! Set type
|
//! Set type
|
||||||
void setCombinedType(const QString &type) { m_combinedType = type.trimmed().toUpper(); }
|
void setCombinedType(const QString &type) { m_combinedType = type.trimmed().toUpper(); }
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ namespace BlackSimPlugin
|
|||||||
dpAppDesc.guidApplication = CFs9Sdk::guid();
|
dpAppDesc.guidApplication = CFs9Sdk::guid();
|
||||||
|
|
||||||
// We now have the host address so lets enum
|
// We now have the host address so lets enum
|
||||||
if (isFailure(hr = m_directPlayPeer->EnumHosts(&dpAppDesc, // pApplicationDesc
|
if (isFailure(hr = m_directPlayPeer->EnumHosts(&dpAppDesc, // pApplicationDesc
|
||||||
m_hostAddress, // pdpaddrHost
|
m_hostAddress, // pdpaddrHost
|
||||||
m_deviceAddress, // pdpaddrDeviceInfo
|
m_deviceAddress, // pdpaddrDeviceInfo
|
||||||
nullptr, 0, // pvUserEnumData, size
|
nullptr, 0, // pvUserEnumData, size
|
||||||
@@ -364,10 +364,23 @@ namespace BlackSimPlugin
|
|||||||
sendMessage(paramMessage);
|
sendMessage(paramMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFs9Sdk::EngineType aircraftToFS9EngineType(const CSimulatedAircraft &aircraft)
|
||||||
|
{
|
||||||
|
const QChar engine = aircraft.getAircraftIcaoCode().getEngineTypeChar();
|
||||||
|
const QChar type = aircraft.getAircraftIcaoCode().getAircraftTypeChar();
|
||||||
|
|
||||||
|
if (type == 'H') return CFs9Sdk::ENGINE_TYPE_HELO_TURBINE;
|
||||||
|
if (engine == 'J') return CFs9Sdk::ENGINE_TYPE_JET;
|
||||||
|
if (engine == 'P') return CFs9Sdk::ENGINE_TYPE_PISTON;
|
||||||
|
if (engine == 'T') return CFs9Sdk::ENGINE_TYPE_TURBOPROP;
|
||||||
|
|
||||||
|
return CFs9Sdk::ENGINE_TYPE_JET;
|
||||||
|
}
|
||||||
|
|
||||||
void CFs9Client::sendMultiplayerChangePlayerPlane()
|
void CFs9Client::sendMultiplayerChangePlayerPlane()
|
||||||
{
|
{
|
||||||
MPChangePlayerPlane mpChangePlayerPlane;
|
MPChangePlayerPlane mpChangePlayerPlane;
|
||||||
mpChangePlayerPlane.engine = CFs9Sdk::ENGINE_TYPE_JET;
|
mpChangePlayerPlane.engine = aircraftToFS9EngineType(m_remoteAircraft);
|
||||||
mpChangePlayerPlane.aircraft_name = m_modelName;
|
mpChangePlayerPlane.aircraft_name = m_modelName;
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
MultiPlayerPacketParser::writeType(message, CFs9Sdk::MULTIPLAYER_PACKET_ID_CHANGE_PLAYER_PLANE);
|
MultiPlayerPacketParser::writeType(message, CFs9Sdk::MULTIPLAYER_PACKET_ID_CHANGE_PLAYER_PLANE);
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CFs9Client(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft,
|
CFs9Client(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft,
|
||||||
const BlackMisc::PhysicalQuantities::CTime &updateInterval,
|
const BlackMisc::PhysicalQuantities::CTime &updateInterval,
|
||||||
BlackMisc::Simulation::CInterpolationLogger *logger,
|
BlackMisc::Simulation::CInterpolationLogger *logger,
|
||||||
BlackCore::ISimulator *simulator);
|
BlackCore::ISimulator *simulator);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
@@ -53,7 +53,7 @@ namespace BlackSimPlugin
|
|||||||
void start();
|
void start();
|
||||||
|
|
||||||
//! Get interpolator @{
|
//! Get interpolator @{
|
||||||
BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() { return &m_interpolator; }
|
BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() { return &m_interpolator; }
|
||||||
const BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() const { return &m_interpolator; }
|
const BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() const { return &m_interpolator; }
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
@@ -100,13 +100,13 @@ namespace BlackSimPlugin
|
|||||||
const BlackCore::ISimulator *simulator() const;
|
const BlackCore::ISimulator *simulator() const;
|
||||||
|
|
||||||
BlackMisc::Simulation::CSimulatedAircraft m_remoteAircraft;
|
BlackMisc::Simulation::CSimulatedAircraft m_remoteAircraft;
|
||||||
BlackMisc::PhysicalQuantities::CTime m_updateInterval;
|
BlackMisc::PhysicalQuantities::CTime m_updateInterval;
|
||||||
BlackMisc::Simulation::CInterpolatorMulti m_interpolator;
|
BlackMisc::Simulation::CInterpolatorMulti m_interpolator;
|
||||||
QString m_modelName;
|
QString m_modelName;
|
||||||
int m_timerId = 0;
|
int m_timerId = 0;
|
||||||
|
|
||||||
IDirectPlay8Address *m_hostAddress = nullptr;
|
IDirectPlay8Address *m_hostAddress = nullptr;
|
||||||
ClientStatus m_clientStatus = Disconnected;
|
ClientStatus m_clientStatus = Disconnected;
|
||||||
|
|
||||||
PLAYER_INFO_STRUCT m_playerInfo;
|
PLAYER_INFO_STRUCT m_playerInfo;
|
||||||
DPN_PLAYER_INFO m_player;
|
DPN_PLAYER_INFO m_player;
|
||||||
|
|||||||
Reference in New Issue
Block a user