mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +08:00
refs #444 Use CAircraftMatcher to match a model and send it to xbus
In case the model name is empty, xbus falls back to its former behaviour and lets libxplanemp do the matching. If aircraft matcher does provide a model this will be used instead. Until model mapping database is ready, a dummy provider has been added. Hence CAircraftMatcher will always return a default model.
This commit is contained in:
committed by
Mathew Sutcliffe
parent
b28634e586
commit
1ac89d477f
@@ -173,12 +173,24 @@ namespace XBus
|
||||
emit installedModelsUpdated(modelNames, icaos, airlines, liveries);
|
||||
}
|
||||
|
||||
void CTraffic::addPlane(const QString &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery)
|
||||
void CTraffic::addPlane(const QString &callsign, const QString &modelName, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery)
|
||||
{
|
||||
auto id = XPMPCreatePlane(qPrintable(aircraftIcao), qPrintable(airlineIcao), qPrintable(livery), getPlaneData, static_cast<void *>(this));
|
||||
auto plane = new Plane(id, callsign, aircraftIcao, airlineIcao, livery);
|
||||
m_planesByCallsign[callsign] = plane;
|
||||
m_planesById[id] = plane;
|
||||
XPMPPlaneID id = nullptr;
|
||||
if (modelName.isEmpty())
|
||||
{
|
||||
id = XPMPCreatePlane(qPrintable(aircraftIcao), qPrintable(airlineIcao), qPrintable(livery), getPlaneData, static_cast<void *>(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
id = XPMPCreatePlaneWithModelName(qPrintable(modelName), qPrintable(aircraftIcao), qPrintable(airlineIcao), qPrintable(livery), getPlaneData, static_cast<void *>(this));
|
||||
}
|
||||
|
||||
if (id)
|
||||
{
|
||||
auto plane = new Plane(id, callsign, aircraftIcao, airlineIcao, livery);
|
||||
m_planesByCallsign[callsign] = plane;
|
||||
m_planesById[id] = plane;
|
||||
}
|
||||
}
|
||||
|
||||
void CTraffic::removePlane(const QString &callsign)
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace XBus
|
||||
void updateInstalledModels();
|
||||
|
||||
//! Introduce a new traffic aircraft
|
||||
void addPlane(const QString &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery);
|
||||
void addPlane(const QString &callsign, const QString &modelName, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery);
|
||||
|
||||
//! Remove a traffic aircraft
|
||||
void removePlane(const QString &callsign);
|
||||
|
||||
Reference in New Issue
Block a user