mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +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;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
// Shortcut for most cases
|
||||
|
||||
@@ -145,6 +145,9 @@ namespace BlackMisc
|
||||
//! Aircraft type, such a L(andplane), S(eaplane), H(elicopter)
|
||||
QString getAircraftType() const;
|
||||
|
||||
//! Aircraft type, such a L(andplane), S(eaplane), H(elicopter)
|
||||
QChar getAircraftTypeChar() const;
|
||||
|
||||
//! Set type
|
||||
void setCombinedType(const QString &type) { m_combinedType = type.trimmed().toUpper(); }
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace BlackSimPlugin
|
||||
dpAppDesc.guidApplication = CFs9Sdk::guid();
|
||||
|
||||
// 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_deviceAddress, // pdpaddrDeviceInfo
|
||||
nullptr, 0, // pvUserEnumData, size
|
||||
@@ -364,10 +364,23 @@ namespace BlackSimPlugin
|
||||
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()
|
||||
{
|
||||
MPChangePlayerPlane mpChangePlayerPlane;
|
||||
mpChangePlayerPlane.engine = CFs9Sdk::ENGINE_TYPE_JET;
|
||||
mpChangePlayerPlane.engine = aircraftToFS9EngineType(m_remoteAircraft);
|
||||
mpChangePlayerPlane.aircraft_name = m_modelName;
|
||||
QByteArray message;
|
||||
MultiPlayerPacketParser::writeType(message, CFs9Sdk::MULTIPLAYER_PACKET_ID_CHANGE_PLAYER_PLANE);
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace BlackSimPlugin
|
||||
|
||||
//! Constructor
|
||||
CFs9Client(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft,
|
||||
const BlackMisc::PhysicalQuantities::CTime &updateInterval,
|
||||
BlackMisc::Simulation::CInterpolationLogger *logger,
|
||||
const BlackMisc::PhysicalQuantities::CTime &updateInterval,
|
||||
BlackMisc::Simulation::CInterpolationLogger *logger,
|
||||
BlackCore::ISimulator *simulator);
|
||||
|
||||
//! Destructor
|
||||
@@ -53,7 +53,7 @@ namespace BlackSimPlugin
|
||||
void start();
|
||||
|
||||
//! 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; }
|
||||
//! @}
|
||||
|
||||
@@ -100,13 +100,13 @@ namespace BlackSimPlugin
|
||||
const BlackCore::ISimulator *simulator() const;
|
||||
|
||||
BlackMisc::Simulation::CSimulatedAircraft m_remoteAircraft;
|
||||
BlackMisc::PhysicalQuantities::CTime m_updateInterval;
|
||||
BlackMisc::PhysicalQuantities::CTime m_updateInterval;
|
||||
BlackMisc::Simulation::CInterpolatorMulti m_interpolator;
|
||||
QString m_modelName;
|
||||
int m_timerId = 0;
|
||||
|
||||
IDirectPlay8Address *m_hostAddress = nullptr;
|
||||
ClientStatus m_clientStatus = Disconnected;
|
||||
IDirectPlay8Address *m_hostAddress = nullptr;
|
||||
ClientStatus m_clientStatus = Disconnected;
|
||||
|
||||
PLAYER_INFO_STRUCT m_playerInfo;
|
||||
DPN_PLAYER_INFO m_player;
|
||||
|
||||
Reference in New Issue
Block a user