diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f927cd..c934085 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: ##################################### # Linux with GCC build-lin: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: platform: lin steps: diff --git a/Example/LTAPI.xcodeproj/xcshareddata/xcschemes/LTAPIExample.xcscheme b/Example/LTAPI.xcodeproj/xcshareddata/xcschemes/LTAPIExample.xcscheme index 6439f2c..b679c16 100644 --- a/Example/LTAPI.xcodeproj/xcshareddata/xcschemes/LTAPIExample.xcscheme +++ b/Example/LTAPI.xcodeproj/xcshareddata/xcschemes/LTAPIExample.xcscheme @@ -1,7 +1,7 @@ + version = "2.0"> - - + allowLocationSimulation = "YES" + launchAutomaticallySubstyle = "2"> 100 ? 100 : numBulkAc), vBulkNum (new LTAPIAircraft::LTAPIBulkData[iBulkAc]), vInfoTexts(new LTAPIAircraft::LTAPIBulkInfoTexts[iBulkAc]), pfCreateAcObject(_pfCreateAcObject) -{ - // Create the shared dataRefs to access camera aircraft event notifications - XPLMShareData(SDR_CAMERA_MODES_ID, xplmType_Int, nullptr, nullptr); - XPLMShareData(SDR_CAMERA_TCAS_IDX, xplmType_Int, (XPLMDataChanged_f)(<APIConnect::CameraSharedDataCB), this); -} +{} LTAPIConnect::~LTAPIConnect() { @@ -407,6 +403,15 @@ std::chrono::system_clock::time_point LTAPIConnect::getLTSimTimePoint () const MapLTAPIAircraft& LTAPIConnect::UpdateAcList (ListLTAPIAircraft* plistRemovedAc) { + // One-time init that needs to be done before the first aircraft is created + static bool bOneTimeInitDone = false; + if (!bOneTimeInitDone) { + // Create the shared dataRefs to access camera aircraft event notifications + XPLMShareData(SDR_CAMERA_MODES_ID, xplmType_Int, nullptr, nullptr); + XPLMShareData(SDR_CAMERA_TCAS_IDX, xplmType_Int, (XPLMDataChanged_f)(<APIConnect::CameraSharedDataCB), this); + bOneTimeInitDone = true; + } + // These are the bulk input/output dataRefs in LiveTraffic, // with which we fetch mass data from LiveTraffic static LTDataRef DRquick("livetraffic/bulk/quick"); @@ -507,8 +512,8 @@ SPtrLTAPIAircraft LTAPIConnect::getAcInCameraView() const } -// LTAPIConnect::Clear camera information, ie. delcare that no aircraft is currently being viewed -void clearCameraInfo () +// Clear camera information, ie. delcare that no aircraft is currently being viewed +void LTAPIConnect::clearCameraInfo () { LTAPI::setCameraAcDataRefs(0, 0); }