1
0
Fork 0

Launcher: Fix helipad selection

This commit is contained in:
James Turner 2018-07-25 09:27:14 +01:00
parent f3a1c10b24
commit 4395f96b13
4 changed files with 22 additions and 9 deletions

View file

@ -411,7 +411,9 @@ void LauncherController::updateSelectedAircraft()
m_selectedAircraftInfo->setUri(m_selectedAircraft); m_selectedAircraftInfo->setUri(m_selectedAircraft);
QModelIndex index = m_aircraftModel->indexOfAircraftURI(m_selectedAircraft); QModelIndex index = m_aircraftModel->indexOfAircraftURI(m_selectedAircraft);
if (index.isValid()) { if (index.isValid()) {
m_aircraftType = Airplane; // we have to default to unknown here, until we have an explicit
// way to determine if it's a regular aircraft or not
m_aircraftType = Unknown;
if (index.data(AircraftIsHelicopterRole).toBool()) { if (index.data(AircraftIsHelicopterRole).toBool()) {
m_aircraftType = Helicopter; m_aircraftType = Helicopter;
} else if (index.data(AircraftIsSeaplaneRole).toBool()) { } else if (index.data(AircraftIsSeaplaneRole).toBool()) {

View file

@ -158,7 +158,8 @@ public:
enum AircraftType enum AircraftType
{ {
Airplane = 0, Unknown = 0,
Airplane,
Seaplane, Seaplane,
Helicopter, Helicopter,
Airship Airship

View file

@ -115,14 +115,23 @@ public:
addType(FGPositioned::NDB); addType(FGPositioned::NDB);
} }
if (aircraft == LauncherController::Helicopter) {
addType(FGPositioned::HELIPAD);
}
if (aircraft == LauncherController::Seaplane) {
addType(FGPositioned::SEAPORT);
} else {
addType(FGPositioned::AIRPORT); addType(FGPositioned::AIRPORT);
switch (aircraft) {
case LauncherController::Airplane:
break;
case LauncherController::Helicopter:
addType(FGPositioned::HELIPORT);
break;
case LauncherController::Seaplane:
addType(FGPositioned::SEAPORT);
break;
default:
addType(FGPositioned::HELIPORT);
addType(FGPositioned::SEAPORT);
} }
} }
}; };

View file

@ -54,6 +54,7 @@ public:
enum AircraftType enum AircraftType
{ {
Unknown = LauncherController::Unknown,
Airplane = LauncherController::Airplane, Airplane = LauncherController::Airplane,
Seaplane = LauncherController::Seaplane, Seaplane = LauncherController::Seaplane,
Helicopter = LauncherController::Helicopter, Helicopter = LauncherController::Helicopter,
@ -62,7 +63,7 @@ public:
Q_ENUMS(AircraftType) Q_ENUMS(AircraftType)
Q_INVOKABLE void setSearch(QString t, AircraftType aircraft); Q_INVOKABLE void setSearch(QString t, AircraftType aircraft = Unknown);
Q_INVOKABLE void clear(); Q_INVOKABLE void clear();