[FS9] Fixes

* guards like "if (!m_fs9Host.data()) return"
* bogus function "sendMultiplayerParts" (at least ot have it in place)
* fixed "testSendSituationAndParts"
This commit is contained in:
Klaus Basan
2020-04-13 14:55:13 +02:00
committed by Mat Sutcliffe
parent 1d72d89461
commit 41f28ea858
3 changed files with 17 additions and 5 deletions

View File

@@ -352,6 +352,11 @@ namespace BlackSimPlugin
sendMessage(positionMessage);
}
void CFs9Client::sendMultiplayerParts(const CAircraftParts &parts)
{
Q_UNUSED(parts)
}
void CFs9Client::sendMultiplayerParamaters()
{
QByteArray paramMessage;

View File

@@ -60,9 +60,12 @@ namespace BlackSimPlugin
//! \copydoc BlackMisc::Simulation::CInterpolator::getInterpolationMessages
BlackMisc::CStatusMessageList getInterpolationMessages(BlackMisc::Simulation::CInterpolationAndRenderingSetupBase::InterpolatorMode mode) const;
//! Send a situtaion (position)
//! Send a situation (position)
void sendMultiplayerPosition(const BlackMisc::Aviation::CAircraftSituation &situation);
//! Send parts (lights, gear ...)
void sendMultiplayerParts(const BlackMisc::Aviation::CAircraftParts &parts);
//! Send new text message
void sendTextMessage(const QString &textMessage);

View File

@@ -267,6 +267,8 @@ namespace BlackSimPlugin
void CSimulatorFs9::displayStatusMessage(const CStatusMessage &message) const
{
if (!m_fs9Host.data()) { return; }
// Avoid errors from CDirectPlayPeer as it may end in infinite loop
if (message.getSeverity() == CStatusMessage::SeverityError && message.isFromClass<CDirectPlayPeer>())
{
@@ -281,6 +283,7 @@ namespace BlackSimPlugin
void CSimulatorFs9::displayTextMessage(const CTextMessage &message) const
{
if (!m_fs9Host.data()) { return; }
QMetaObject::invokeMethod(m_fs9Host.data(), "sendTextMessage", Q_ARG(QString, message.asString(true, true)));
}
@@ -301,10 +304,11 @@ namespace BlackSimPlugin
Q_UNUSED(parts)
int u = 0;
if (situation.isNull())
if (!situation.isNull())
{
u++;
client->sendMultiplayerPosition(situation);
if (!parts.isNull()) { client->sendMultiplayerParts(parts); }
}
return u > 0;
}
@@ -529,8 +533,8 @@ namespace BlackSimPlugin
void CSimulatorFs9Listener::checkImpl()
{
if (m_timer) { m_timer->start(); }
if (this->isShuttingDown()) { return; }
if (m_timer) { m_timer->start(); }
QPointer<CSimulatorFs9Listener> myself(this);
QTimer::singleShot(10, this, [ = ]
@@ -590,7 +594,7 @@ namespace BlackSimPlugin
CSimulatorFs9Factory::~CSimulatorFs9Factory()
{ }
BlackCore::ISimulator *CSimulatorFs9Factory::create(const CSimulatorPluginInfo &info,
ISimulator *CSimulatorFs9Factory::create(const CSimulatorPluginInfo &info,
IOwnAircraftProvider *ownAircraftProvider,
IRemoteAircraftProvider *remoteAircraftProvider,
IWeatherGridProvider *weatherGridProvider,
@@ -599,7 +603,7 @@ namespace BlackSimPlugin
return new CSimulatorFs9(info, m_fs9Host, m_lobbyClient, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, clientProvider, this);
}
BlackCore::ISimulatorListener *CSimulatorFs9Factory::createListener(const CSimulatorPluginInfo &info)
ISimulatorListener *CSimulatorFs9Factory::createListener(const CSimulatorPluginInfo &info)
{
return new CSimulatorFs9Listener(info, m_fs9Host, m_lobbyClient);
}