From 5603a51d232a179e0864361272706888a73598fa Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Fri, 21 Apr 2023 16:45:44 +0200 Subject: [PATCH 1/4] code formatting --- com/Airport.cpp | 2 -- vACDM.cpp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/com/Airport.cpp b/com/Airport.cpp index 6a38a53..9ca9dba 100644 --- a/com/Airport.cpp +++ b/com/Airport.cpp @@ -260,7 +260,6 @@ void Airport::updateAsrt(const std::string& callsign, const std::chrono::utc_clo root["vacdm"] = Json::Value(); root["vacdm"]["asrt"] = Airport::timestampToIsoString(asrt); - it->second[FlightEuroscope].lastUpdate = std::chrono::utc_clock::now(); it->second[FlightConsolidated].asrt = asrt; @@ -283,7 +282,6 @@ void Airport::updateAort(const std::string& callsign, const std::chrono::utc_clo root["vacdm"] = Json::Value(); root["vacdm"]["aort"] = Airport::timestampToIsoString(aort); - it->second[FlightEuroscope].lastUpdate = std::chrono::utc_clock::now(); it->second[FlightConsolidated].aort = aort; diff --git a/vACDM.cpp b/vACDM.cpp index 628efb5..3c969ca 100644 --- a/vACDM.cpp +++ b/vACDM.cpp @@ -667,7 +667,7 @@ bool vACDM::OnCompileCommand(const char* sCommandLine) { bool userIsObs = std::string_view(this->ControllerMyself().GetCallsign()).ends_with("_OBS") == true; bool serverAllowsObsAsMaster = this->m_config.masterAsObserver; bool serverAllowsSweatboxAsMaster = this->m_config.masterInSweatbox; - + std::string userIsNotEligibleMessage; if (!userConnected) { @@ -679,7 +679,7 @@ bool vACDM::OnCompileCommand(const char* sCommandLine) { else if (userIsInSweatbox && !serverAllowsSweatboxAsMaster) { userIsNotEligibleMessage = "You are logged in on a Sweatbox Server and Server does not allow Sweatbox connections " + std::to_string(this->GetConnectionType()); } - else { + else { this->DisplayUserMessage("vACDM", PLUGIN_NAME, "Executing vACDM as the MASTER", true, true, true, true, false); logging::Logger::instance().log("vACDM", logging::Logger::Level::Info, "Switched to MASTER"); com::Server::instance().setMaster(true); From 41691ea0f17c3482b4696663ef04567a66e3376b Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Fri, 21 Apr 2023 16:46:10 +0200 Subject: [PATCH 2/4] fix a debug message --- vACDM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vACDM.cpp b/vACDM.cpp index 3c969ca..6efbf24 100644 --- a/vACDM.cpp +++ b/vACDM.cpp @@ -677,7 +677,7 @@ bool vACDM::OnCompileCommand(const char* sCommandLine) { userIsNotEligibleMessage = "You are logged in as Observer and Server does not allow Observers to be Master"; } else if (userIsInSweatbox && !serverAllowsSweatboxAsMaster) { - userIsNotEligibleMessage = "You are logged in on a Sweatbox Server and Server does not allow Sweatbox connections " + std::to_string(this->GetConnectionType()); + userIsNotEligibleMessage = "You are logged in on a Sweatbox Server and Server does not allow Sweatbox connections"; } else { this->DisplayUserMessage("vACDM", PLUGIN_NAME, "Executing vACDM as the MASTER", true, true, true, true, false); From 8f4f3f9a6aa845f48d8c0de997bcb7c1d79e574a Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Fri, 21 Apr 2023 16:46:35 +0200 Subject: [PATCH 3/4] update to the current main version to avoid testing problems --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b955b97..ad9b663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.14) # define the project -PROJECT(vACDM LANGUAGES C CXX VERSION "0.1.1") +PROJECT(vACDM LANGUAGES C CXX VERSION "1.0.0") SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) SET(CMAKE_CXX_STANDARD 20) SET(CMAKE_CXX_STANDARD_REQUIRED ON) From 9c3ff88aae26bb22458feb36aee533f11058bf29 Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Fri, 21 Apr 2023 16:47:16 +0200 Subject: [PATCH 4/4] do not send null-tsat. jsoncpp creates implicitly entries, if they do not exist -> do not copy over values --- com/Airport.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/com/Airport.cpp b/com/Airport.cpp index 9ca9dba..d455d77 100644 --- a/com/Airport.cpp +++ b/com/Airport.cpp @@ -124,10 +124,10 @@ void Airport::updateExot(const std::string& callsign, const std::chrono::utc_clo root["vacdm"] = Json::Value(); root["vacdm"]["exot"] = std::chrono::duration_cast(exot.time_since_epoch()).count(); root["vacdm"]["tsat"] = Airport::timestampToIsoString(types::defaultTime); - root["vacdm"]["ttot"] = root["vacdm"]["tsat"].asString(); - root["vacdm"]["asat"] = root["vacdm"]["tsat"].asString(); - root["vacdm"]["aobt"] = root["vacdm"]["tsat"].asString(); - root["vacdm"]["atot"] = root["vacdm"]["tsat"].asString(); + root["vacdm"]["ttot"] = Airport::timestampToIsoString(types::defaultTime); + root["vacdm"]["asat"] = Airport::timestampToIsoString(types::defaultTime); + root["vacdm"]["aobt"] = Airport::timestampToIsoString(types::defaultTime); + root["vacdm"]["atot"] = Airport::timestampToIsoString(types::defaultTime); it->second[FlightEuroscope].lastUpdate = std::chrono::utc_clock::now(); it->second[FlightConsolidated].tsat = types::defaultTime; @@ -160,10 +160,10 @@ void Airport::updateTobt(const std::string& callsign, const std::chrono::utc_clo root["vacdm"]["tsat"] = Airport::timestampToIsoString(types::defaultTime); if (false == manualTobt) root["vacdm"]["tobt_state"] = "CONFIRMED"; - root["vacdm"]["ttot"] = root["vacdm"]["tsat"].asString(); - root["vacdm"]["asat"] = root["vacdm"]["tsat"].asString(); - root["vacdm"]["aobt"] = root["vacdm"]["tsat"].asString(); - root["vacdm"]["atot"] = root["vacdm"]["tsat"].asString(); + root["vacdm"]["ttot"] = Airport::timestampToIsoString(types::defaultTime); + root["vacdm"]["asat"] = Airport::timestampToIsoString(types::defaultTime); + root["vacdm"]["aobt"] = Airport::timestampToIsoString(types::defaultTime); + root["vacdm"]["atot"] = Airport::timestampToIsoString(types::defaultTime); it->second[FlightEuroscope].lastUpdate = std::chrono::utc_clock::now(); it->second[FlightConsolidated].tobt = tobt;