diff --git a/appveyor.yml b/.appveyor.yml similarity index 91% rename from appveyor.yml rename to .appveyor.yml index 861a6c21e..22a306fcf 100644 --- a/appveyor.yml +++ b/.appveyor.yml @@ -9,17 +9,7 @@ #---------------------------------# # version format -version: 1.5.{build} - -# branches to build -branches: - # whitelist - only: - - master - - # blacklist - except: - - gh-pages +version: 1.6.{build} # Maximum number of concurrent jobs for the project max_jobs: 1 @@ -29,7 +19,7 @@ max_jobs: 1 #---------------------------------# # Build worker image (VM template) -os: Visual Studio 2019 +os: Visual Studio 2022 #---------------------------------# # build configuration # @@ -59,3 +49,5 @@ after_build: artifacts: - path: vSMR-nightly.zip + + diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index 061efb0cc..8ace590ca 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -52,6 +52,7 @@ string tdest; string ttype; int messageId = 0; +int randomInterval = 0; clock_t timer; @@ -66,6 +67,11 @@ char recv_buf[1024]; vector RadarScreensOpened; + +void initializeRandomInterval() { + randomInterval = 45 + rand() % 31; // 45 to 75 seconds +} + void datalinkLogin(void * arg) { string raw; string url = baseUrlDatalink; @@ -274,7 +280,10 @@ CSMRPlugin::CSMRPlugin(void) :CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE, MY_PL RegisterTagItemFunction("Datalink menu", TAG_FUNC_DATALINK_MENU); messageId = rand() % 10000 + 1789; - + + srand(time(NULL)); // Seed the RNG once at the start + initializeRandomInterval(); + timer = clock(); if (httpHelper == NULL) @@ -627,9 +636,10 @@ void CSMRPlugin::OnTimer(int Counter) HoppieConnected = false; } - if (((clock() - timer) / CLOCKS_PER_SEC) > 10 && HoppieConnected) { + if (((clock() - timer) / CLOCKS_PER_SEC) > randomInterval && HoppieConnected) { _beginthread(pollMessages, 0, NULL); timer = clock(); + initializeRandomInterval(); // Generate a new interval for the next check } for (auto &ac : AircraftWilco)