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:
Roland Winklmeier
2015-05-21 13:34:53 +02:00
parent 74b6bb9756
commit 6995ad7063
6 changed files with 96 additions and 134 deletions

View File

@@ -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