refs #789, FSX errors OPERATION_INVALID and EXCEPTION_UNRECOGNIZED_ID

* only emit aircraft as rendered when object id is received, not before
* added CSimualtedAircraft to CSimConnectObject (so it can be used as signal argument)
* some utility functions to get callsign/simobject by id
This commit is contained in:
Klaus Basan
2016-10-24 03:33:46 +02:00
parent 6a8c8c8889
commit f8c9782da4
8 changed files with 187 additions and 96 deletions

View File

@@ -72,7 +72,7 @@ namespace BlackCore
if (!remoteAircraft.isEnabled()) { return false; }
// if not restriced, directly change
if (!isRenderingRestricted()) { return this->physicallyAddRemoteAircraft(remoteAircraft); }
if (!isRenderingRestricted()) { this->physicallyAddRemoteAircraft(remoteAircraft); return true; }
// will be added with next snapshot
return false;
@@ -81,7 +81,7 @@ namespace BlackCore
bool CSimulatorCommon::logicallyRemoveRemoteAircraft(const CCallsign &callsign)
{
// if not restriced, directly change
if (!isRenderingRestricted()) { return this->physicallyRemoveRemoteAircraft(callsign); }
if (!isRenderingRestricted()) { this->physicallyRemoveRemoteAircraft(callsign); return true; }
// will be added with next snapshot
return false;
@@ -298,7 +298,8 @@ namespace BlackCore
int removed = 0;
for (const CCallsign &callsign : callsigns)
{
if (physicallyRemoveRemoteAircraft(callsign)) { removed++; }
physicallyRemoveRemoteAircraft(callsign);
removed++;
}
return removed;
}
@@ -338,8 +339,9 @@ namespace BlackCore
for (const CSimulatedAircraft &aircraft : aircraftToBeAdded)
{
Q_ASSERT_X(aircraft.isEnabled(), Q_FUNC_INFO, "Disabled aircraft detected as to be added");
bool a = this->physicallyAddRemoteAircraft(aircraft);
changed = changed || a;
Q_ASSERT_X(aircraft.hasModelString(), Q_FUNC_INFO, "Missing model string");
this->physicallyAddRemoteAircraft(aircraft);
changed = true;
}
}
}