mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
refs #409 Refactor matching implementation in MSFS drivers
CAircraftMapper used to be designed around FSX only. CAircraftMatcher instead is more generic for different MSFS versions. Therefore it is replaced with the latter. This change also gets rid of the singleton and its drawbacks by using the plugin storage. Last but not least it implements the first model matching for FS9.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/network/aircraftmappinglist.h"
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <type_traits>
|
||||
@@ -43,7 +44,8 @@ namespace BlackSimPlugin
|
||||
IRemoteAircraftProvider *remoteAircraftProvider,
|
||||
IPluginStorageProvider *pluginStorageProvider,
|
||||
QObject *parent) :
|
||||
CSimulatorFsCommon(info, ownAircraftProvider, remoteAircraftProvider, pluginStorageProvider, parent)
|
||||
CSimulatorFsCommon(info, ownAircraftProvider, remoteAircraftProvider, pluginStorageProvider,
|
||||
simObjectsDir(), excludeDirectories(), parent)
|
||||
{
|
||||
Q_ASSERT(ownAircraftProvider);
|
||||
Q_ASSERT(remoteAircraftProvider);
|
||||
@@ -51,6 +53,12 @@ namespace BlackSimPlugin
|
||||
|
||||
m_useFsuipc = false; // do not use FSUIPC at the moment with FSX
|
||||
this->m_interpolator = new CInterpolatorLinear(remoteAircraftProvider, this);
|
||||
m_modelMatcher.setDefaultModel(CAircraftModel(
|
||||
"Boeing 737-800 Paint1",
|
||||
CAircraftModel::TypeModelMatchingDefaultModel,
|
||||
"B737-800 default model",
|
||||
CAircraftIcaoData(CAircraftIcaoCode("B738", "L2J"), CAirlineIcaoCode(), "FFFFFF")
|
||||
));
|
||||
}
|
||||
|
||||
CSimulatorFsx::~CSimulatorFsx()
|
||||
@@ -155,7 +163,7 @@ namespace BlackSimPlugin
|
||||
++m_nextObjID;
|
||||
|
||||
// matched models
|
||||
CAircraftModel aircraftModel = modelMatching(newRemoteAircraft);
|
||||
CAircraftModel aircraftModel = getClosestMatch(newRemoteAircraft);
|
||||
Q_ASSERT_X(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "mismatching callsigns");
|
||||
|
||||
this->updateAircraftModel(callsign, aircraftModel, simulatorOriginator());
|
||||
@@ -899,5 +907,6 @@ namespace BlackSimPlugin
|
||||
{
|
||||
m_timer->stop();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user