refs #707, removed originator from some signatures

* not used in remote aircraft provider
* adjusted all using interfaces
This commit is contained in:
Klaus Basan
2016-07-12 03:05:04 +02:00
parent b959972e0c
commit 86d85c6b60
23 changed files with 118 additions and 143 deletions

View File

@@ -64,7 +64,7 @@ namespace BlackSimPlugin
else
dHigh = dHigh - dLow;
position.setLongitude(CLongitude(dHigh * 360.0 / ( 65536.0 * 65536.0), CAngleUnit::deg()));
position.setLongitude(CLongitude(dHigh * 360.0 / (65536.0 * 65536.0), CAngleUnit::deg()));
dHigh = positionVelocity.alt_i;
dLow = positionVelocity.alt_f;
@@ -167,8 +167,8 @@ namespace BlackSimPlugin
// matched models
CAircraftModel aircraftModel = getClosestMatch(newRemoteAircraftCopy);
Q_ASSERT(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign());
updateAircraftModel(newRemoteAircraft.getCallsign(), aircraftModel, identifier());
updateAircraftRendered(newRemoteAircraft.getCallsign(), true, identifier());
updateAircraftModel(newRemoteAircraft.getCallsign(), aircraftModel);
updateAircraftRendered(newRemoteAircraft.getCallsign(), true);
CSimulatedAircraft aircraftAfterModelApplied(getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
aircraftAfterModelApplied.setRendered(true);
emit modelMatchingCompleted(aircraftAfterModelApplied);
@@ -179,7 +179,7 @@ namespace BlackSimPlugin
client->start();
m_hashFs9Clients.insert(callsign, client);
updateAircraftRendered(callsign, true, this->identifier());
updateAircraftRendered(callsign, true);
CLogMessage(this).info("FS9: Added aircraft %1") << callsign.toQString();
return true;
}
@@ -191,7 +191,7 @@ namespace BlackSimPlugin
auto fs9Client = m_hashFs9Clients.value(callsign);
fs9Client->quit();
m_hashFs9Clients.remove(callsign);
updateAircraftRendered(callsign, false, this->identifier());
updateAircraftRendered(callsign, false);
CLogMessage(this).info("FS9: Removed aircraft %1") << callsign.toQString();
return true;
}
@@ -334,7 +334,7 @@ namespace BlackSimPlugin
const auto currentPosition = CCoordinateGeodetic { aircraftSituation.latitude(), aircraftSituation.longitude(), {0} };
if (CWeatherScenario::isRealWeatherScenario(m_weatherScenarioSettings.get()) &&
calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20 )
calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20)
{
m_lastWeatherPosition = currentPosition;
const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } };
@@ -389,8 +389,8 @@ namespace BlackSimPlugin
}
CSimulatorFs9Listener::CSimulatorFs9Listener(const CSimulatorPluginInfo &info,
const QSharedPointer<CFs9Host> &fs9Host,
const QSharedPointer<CLobbyClient> &lobbyClient) :
const QSharedPointer<CFs9Host> &fs9Host,
const QSharedPointer<CLobbyClient> &lobbyClient) :
BlackCore::ISimulatorListener(info),
m_timer(new QTimer(this)),
m_fs9Host(fs9Host),

View File

@@ -106,18 +106,15 @@ namespace BlackSimPlugin
return pm;
}
bool CSimulatorFsCommon::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
bool CSimulatorFsCommon::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
{
if (originator == this->identifier()) { return false; }
// remove upfront, and then enable / disable again
this->physicallyRemoveRemoteAircraft(aircraft.getCallsign());
return this->changeRemoteAircraftEnabled(aircraft, originator);
return this->changeRemoteAircraftEnabled(aircraft);
}
bool CSimulatorFsCommon::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
bool CSimulatorFsCommon::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft)
{
if (originator == this->identifier()) { return false; }
if (aircraft.isEnabled())
{
this->physicallyAddRemoteAircraft(aircraft);

View File

@@ -61,10 +61,10 @@ namespace BlackSimPlugin
virtual BlackMisc::CPixmap iconForModel(const QString &modelString) const override;
//! \copydoc BlackCore::ISimulator::changeRemoteAircraftModel
virtual bool changeRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator) override;
virtual bool changeRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) override;
//! \copydoc BlackCore::ISimulator::changeRemoteAircraftEnabled
virtual bool changeRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator) override;
virtual bool changeRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) override;
//! \copydoc BlackCore::ISimulator::enableDebugMessages
virtual void enableDebugMessages(bool driver, bool interpolator) override;

View File

@@ -150,7 +150,7 @@ namespace BlackSimPlugin
CAircraftModel aircraftModel = getClosestMatch(newRemoteAircraft);
Q_ASSERT_X(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "mismatching callsigns");
this->updateAircraftModel(callsign, aircraftModel, identifier());
this->updateAircraftModel(callsign, aircraftModel);
CSimulatedAircraft aircraftAfterModelApplied(getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
// create AI
@@ -174,7 +174,7 @@ namespace BlackSimPlugin
}
aircraftAfterModelApplied.setRendered(rendered);
this->updateAircraftRendered(callsign, rendered, identifier());
this->updateAircraftRendered(callsign, rendered);
emit modelMatchingCompleted(aircraftAfterModelApplied);
return rendered;
@@ -430,7 +430,7 @@ namespace BlackSimPlugin
const auto currentPosition = CCoordinateGeodetic { aircraftSituation.latitude(), aircraftSituation.longitude(), {0} };
if (CWeatherScenario::isRealWeatherScenario(m_weatherScenarioSettings.get()) &&
calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20 )
calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20)
{
m_lastWeatherPosition = currentPosition;
const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } };
@@ -549,7 +549,7 @@ namespace BlackSimPlugin
CCallsign callsign(simObject.getCallsign());
m_simConnectObjects.remove(callsign);
SimConnect_AIRemoveObject(m_hSimConnect, static_cast<SIMCONNECT_OBJECT_ID>(simObject.getObjectId()), static_cast<SIMCONNECT_DATA_REQUEST_ID>(simObject.getRequestId()));
updateAircraftRendered(callsign, false, identifier());
updateAircraftRendered(callsign, false);
CLogMessage(this).info("FSX: Removed aircraft %1") << simObject.getCallsign().toQString();
return true;
}

View File

@@ -233,7 +233,6 @@ namespace BlackSimPlugin
QTimer *m_timer { nullptr };
};
}
} // namespace
#endif // guard

View File

@@ -186,7 +186,7 @@ namespace BlackSimPlugin
if (!CAirportIcaoCode::isValidIcaoDesignator(icao)) { continue; } // tiny airfields in SIM
CCoordinateGeodetic pos(pFacilityAirport->Latitude, pFacilityAirport->Longitude, pFacilityAirport->Altitude);
CAirport airport(CAirportIcaoCode(icao), pos);
CLength d = airport.calculcateDistanceAndBearingToOwnAircraft(posAircraft);
CLength d = airport.calculcateAndUpdateRelativeDistanceAndBearing(posAircraft);
if (d > maxDistance) { continue; }
simulatorFsx->m_airportsInRange.replaceOrAddByIcao(airport);
}

View File

@@ -167,7 +167,7 @@ namespace BlackSimPlugin
const auto currentPosition = CCoordinateGeodetic { situation.latitude(), situation.longitude(), {0} };
if (CWeatherScenario::isRealWeatherScenario(m_weatherScenarioSettings.get()) &&
calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20)
calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20)
{
m_lastWeatherPosition = currentPosition;
const auto weatherGrid = CWeatherGrid { { "", currentPosition } };
@@ -467,7 +467,7 @@ namespace BlackSimPlugin
Q_ASSERT_X(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "mismatching callsigns");
CCallsign callsign(newRemoteAircraft.getCallsign());
this->updateAircraftModel(callsign, aircraftModel, identifier());
this->updateAircraftModel(callsign, aircraftModel);
CSimulatedAircraft aircraftAfterModelApplied(getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
QString livery = aircraftModel.getLivery().getCombinedCode(); //! \todo livery resolution for XP
@@ -475,12 +475,12 @@ namespace BlackSimPlugin
newRemoteAircraft.getAircraftIcaoCode().getDesignator(),
newRemoteAircraft.getAirlineIcaoCode().getDesignator(),
livery);
updateAircraftRendered(newRemoteAircraft.getCallsign(), true, identifier());
updateAircraftRendered(newRemoteAircraft.getCallsign(), true);
CLogMessage(this).info("XP: Added aircraft %1") << newRemoteAircraft.getCallsign().toQString();
bool rendered = true;
aircraftAfterModelApplied.setRendered(rendered);
this->updateAircraftRendered(callsign, rendered, identifier());
this->updateAircraftRendered(callsign, rendered);
emit modelMatchingCompleted(aircraftAfterModelApplied);
return rendered;
@@ -518,7 +518,7 @@ namespace BlackSimPlugin
{
Q_ASSERT(isConnected());
m_traffic->removePlane(callsign.asString());
updateAircraftRendered(callsign, false, identifier());
updateAircraftRendered(callsign, false);
CLogMessage(this).info("XP: Removed aircraft %1") << callsign.toQString();
return true;
}
@@ -528,7 +528,7 @@ namespace BlackSimPlugin
//! \todo XP driver obtain number of removed aircraft
int r = getAircraftInRangeCount();
m_traffic->removeAllPlanes();
updateMarkAllAsNotRendered(identifier());
updateMarkAllAsNotRendered();
CLogMessage(this).info("XP: Removed all aircraft");
return r;
}
@@ -539,18 +539,15 @@ namespace BlackSimPlugin
return getAircraftInRange().findByRendered(true).getCallsigns(); // just a poor workaround
}
bool CSimulatorXPlane::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
bool CSimulatorXPlane::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
{
if (originator == this->identifier()) { return false; }
// remove upfront, and then enable / disable again
this->physicallyRemoveRemoteAircraft(aircraft.getCallsign());
return this->changeRemoteAircraftEnabled(aircraft, originator);
return this->changeRemoteAircraftEnabled(aircraft);
}
bool CSimulatorXPlane::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
bool CSimulatorXPlane::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft)
{
if (originator == this->identifier()) { return false; }
if (aircraft.isEnabled())
{
this->physicallyAddRemoteAircraft(aircraft);
@@ -716,6 +713,5 @@ namespace BlackSimPlugin
start();
}
}
} // namespace
} // namespace

View File

@@ -88,8 +88,8 @@ namespace BlackSimPlugin
virtual int physicallyRemoveAllRemoteAircraft() override;
virtual BlackMisc::Aviation::CCallsignSet physicallyRenderedAircraft() const override;
virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const override;
virtual bool changeRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator) override;
virtual bool changeRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator) override;
virtual bool changeRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) override;
virtual bool changeRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) override;
virtual bool updateOwnSimulatorCockpit(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator) override;
virtual void displayStatusMessage(const BlackMisc::CStatusMessage &message) const override;
virtual void displayTextMessage(const BlackMisc::Network::CTextMessage &message) const override;