mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
Simulator driver fetches and injects weather from weather manager
This commit is contained in:
@@ -133,11 +133,6 @@ namespace BlackSimPlugin
|
||||
m_fsuipc->connect(); // connect FSUIPC too
|
||||
}
|
||||
m_dispatchTimerId = startTimer(50);
|
||||
|
||||
// Pull weather data from core.
|
||||
// Since we don't get weather data from core yet, use hard coded weather.
|
||||
injectWeatherGrid(CWeatherGrid::getCavokGrid());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -333,7 +328,17 @@ namespace BlackSimPlugin
|
||||
{
|
||||
MPPositionVelocity mpPositionVelocity;
|
||||
MultiPlayerPacketParser::readMessage(message, mpPositionVelocity);
|
||||
updateOwnSituation(aircraftSituationfromFS9(mpPositionVelocity));
|
||||
auto aircraftSituation = aircraftSituationfromFS9(mpPositionVelocity);
|
||||
updateOwnSituation(aircraftSituation);
|
||||
|
||||
const auto currentPosition = CCoordinateGeodetic { aircraftSituation.latitude(), aircraftSituation.longitude(), {0} };
|
||||
if (calculateGreatCircleDistance(m_lastWeatherPosition, currentPosition).value(CLengthUnit::mi()) > 20 )
|
||||
{
|
||||
m_lastWeatherPosition = currentPosition;
|
||||
const auto weatherGrid = CWeatherGrid { { "GLOB", currentPosition } };
|
||||
requestWeatherGrid(weatherGrid, { this, &CSimulatorFs9::injectWeatherGrid });
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CFs9Sdk::MPCHAT_PACKET_ID_CHAT_TEXT_SEND:
|
||||
|
||||
@@ -115,6 +115,8 @@ namespace BlackSimPlugin
|
||||
bool m_simConnected = false; //!< Is simulator connected?
|
||||
QSharedPointer<CFs9Host> m_fs9Host;
|
||||
QSharedPointer<CLobbyClient> m_lobbyClient;
|
||||
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_lastWeatherPosition; //!< Own aircraft position at which weather was fetched and injected last
|
||||
};
|
||||
|
||||
//! Listener for FS9
|
||||
|
||||
Reference in New Issue
Block a user