mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
Ref T261, detect gnd.flag (from network) suppport, display gnd.flag info in UI
* add flag info in simulated aircraft * allow to display info in UI * unified naming to "contains" in situation list * updated client provider
This commit is contained in:
@@ -96,12 +96,16 @@ namespace BlackMisc
|
||||
if (situation.getCallsign().isEmpty()) { return false; } // no callsign
|
||||
if (!situation.isOnGround()) { return false; } // nothing to adjust
|
||||
if (situation.getOnGroundDetails() != CAircraftSituation::InFromNetwork) { return false; } // not from network
|
||||
return this->addClientGndCapability(situation.getCallsign());
|
||||
}
|
||||
|
||||
CClient client = this->getClientOrDefaultForCallsign(situation.getCallsign());
|
||||
bool CClientProvider::addClientGndCapability(const CCallsign &callsign)
|
||||
{
|
||||
CClient client = this->getClientOrDefaultForCallsign(callsign);
|
||||
|
||||
// need to change?
|
||||
if (!client.isValid()) { return false; } // no client
|
||||
if (client.hasGndFlagCapability()) { return false; } // already set
|
||||
if (client.hasGndFlagCapability()) { return true; } // already set, but set
|
||||
|
||||
client.addCapability(CClient::FsdWithGroundFlag);
|
||||
QWriteLocker l(&m_lockClient);
|
||||
@@ -145,6 +149,18 @@ namespace BlackMisc
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CClientAware::autoAdjustCientGndCapability(const CAircraftSituation &situation)
|
||||
{
|
||||
if (this->provider()) { return this->provider()->autoAdjustCientGndCapability(situation); }
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CClientAware::addClientGndCapability(const CCallsign &callsign)
|
||||
{
|
||||
if (this->provider()) { return this->provider()->addClientGndCapability(callsign); }
|
||||
return false;
|
||||
}
|
||||
|
||||
CClientProviderDummy *CClientProviderDummy::instance()
|
||||
{
|
||||
static CClientProviderDummy *dummy = new CClientProviderDummy();
|
||||
|
||||
@@ -69,6 +69,10 @@ namespace BlackMisc
|
||||
//! Adjust gnd.flag capability from situation
|
||||
//! \threadsafe
|
||||
virtual bool autoAdjustCientGndCapability(const Aviation::CAircraftSituation &situation) = 0;
|
||||
|
||||
//! Add gnd.flag capability
|
||||
//! \threadsafe
|
||||
virtual bool addClientGndCapability(const Aviation::CCallsign &callsign) = 0;
|
||||
};
|
||||
|
||||
//! Direct in memory access to client (network client) data
|
||||
@@ -88,6 +92,7 @@ namespace BlackMisc
|
||||
virtual int updateOrAddClient(const Aviation::CCallsign &callsign, const CPropertyIndexVariantMap &vm, bool skipEqualValues = true) override;
|
||||
virtual int removeClient(const Aviation::CCallsign &callsign) override;
|
||||
virtual bool autoAdjustCientGndCapability(const Aviation::CAircraftSituation &situation) override;
|
||||
virtual bool addClientGndCapability(const Aviation::CCallsign &callsign) override;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
@@ -126,6 +131,12 @@ namespace BlackMisc
|
||||
//! \copydoc CClientProvider::removeClient
|
||||
int removeClient(const Aviation::CCallsign &callsign);
|
||||
|
||||
//! \copydoc CClientProvider::autoAdjustCientGndCapability
|
||||
bool autoAdjustCientGndCapability(const Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! \copydoc CClientProvider::addClientGndCapability
|
||||
bool addClientGndCapability(const Aviation::CCallsign &callsign);
|
||||
|
||||
//! Provider
|
||||
void setClientProvider(CClientProvider *provider) { this->setProvider(provider); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user