mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 23:35:40 +08:00
Ref T709, return 0 if there is no camera position (nullptr)
This commit is contained in:
committed by
Mat Sutcliffe
parent
917d9bb3e7
commit
5e9be9e96e
@@ -885,11 +885,18 @@ namespace XSwiftBus
|
||||
if (isLosingControl == 1)
|
||||
{
|
||||
// traffic->m_planeViewCallsign.clear();
|
||||
traffic->m_followPlaneViewCallsign.clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cameraPosition)
|
||||
// nothing we can do
|
||||
if (!cameraPosition)
|
||||
{
|
||||
ERROR_LOG("No camera object");
|
||||
traffic->m_followPlaneViewCallsign.clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Ideally we would like to test against right mouse button, but X-Plane SDK does not
|
||||
// allow that.
|
||||
if (!traffic->m_deltaCameraPosition.isInitialized || traffic->m_isSpacePressed)
|
||||
@@ -926,9 +933,11 @@ namespace XSwiftBus
|
||||
}
|
||||
else
|
||||
{
|
||||
if (traffic->m_planesByCallsign.empty()) { return 0; } // paranoia
|
||||
const auto planeIt = traffic->m_planesByCallsign.find(traffic->m_followPlaneViewCallsign);
|
||||
if (planeIt == traffic->m_planesByCallsign.end()) { return 0; }
|
||||
const Plane *plane = planeIt->second;
|
||||
if (!plane) { return 0; }
|
||||
|
||||
XPLMWorldToLocal(plane->position.lat, plane->position.lon, plane->position.elevation * kFtToMeters, &lx, &ly, &lz);
|
||||
if (!isValidPosition(plane->position))
|
||||
@@ -954,7 +963,6 @@ namespace XSwiftBus
|
||||
INFO_LOG("Pos: " + pos2String(cameraPosition));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Return 1 to indicate we want to keep controlling the camera.
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user