From 9a4fe0ea48942737dd9074ccb0da3745665bb868 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 28 Sep 2019 23:08:53 +0200 Subject: [PATCH] Ref T732, improved simulator type resolution for network --- src/blackcore/fsd/fsdclient.cpp | 26 ++++++++---------------- src/blackmisc/simulation/simulatorinfo.h | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/blackcore/fsd/fsdclient.cpp b/src/blackcore/fsd/fsdclient.cpp index 70078f81d..aacc5feec 100644 --- a/src/blackcore/fsd/fsdclient.cpp +++ b/src/blackcore/fsd/fsdclient.cpp @@ -173,25 +173,15 @@ namespace BlackCore void CFSDClient::setSimType(const CSimulatorPluginInfo &simInfo) { //! \fixme Define recognized simulators somewhere */ - if (simInfo.getSimulator() == "fs9") + const CSimulatorInfo::Simulator sim = simInfo.getSimulatorInfo().getSimulator(); + switch (sim) { - m_simType = SimType::MSFS2004; - } - else if (simInfo.getSimulator() == "fsx") - { - m_simType = SimType::MSFSX; - } - else if (simInfo.getSimulator() == "p3d") - { - m_simType = SimType::P3Dv4; - } - else if (simInfo.getSimulator() == "xplane") - { - m_simType = SimType::XPLANE11; - } - else - { - m_simType = SimType::Unknown; + case CSimulatorInfo::FSX: m_simType = SimType::MSFSX; break; + case CSimulatorInfo::P3D: m_simType = SimType::P3Dv4; break; + case CSimulatorInfo::FS9: m_simType = SimType::MSFS2004; break; + case CSimulatorInfo::FG: m_simType = SimType::FlightGear; break; + case CSimulatorInfo::XPLANE: m_simType = SimType::XPLANE11; break; + default: m_simType = SimType::Unknown; break; } } diff --git a/src/blackmisc/simulation/simulatorinfo.h b/src/blackmisc/simulation/simulatorinfo.h index 7818aa460..195ca2bf7 100644 --- a/src/blackmisc/simulation/simulatorinfo.h +++ b/src/blackmisc/simulation/simulatorinfo.h @@ -199,7 +199,7 @@ namespace BlackMisc static CSimulatorInfo fromDatabaseJson(const QJsonObject &json, const QString &prefix); //! Const simulator info objects @{ - static const CSimulatorInfo &fg() { static const CSimulatorInfo s(FG); return s; } + static const CSimulatorInfo &fg() { static const CSimulatorInfo s(FG); return s; } static const CSimulatorInfo &fsx() { static const CSimulatorInfo s(FSX); return s; } static const CSimulatorInfo &p3d() { static const CSimulatorInfo s(P3D); return s; } static const CSimulatorInfo &fs9() { static const CSimulatorInfo s(FS9); return s; }