From 49bff88c4efb857c83288c7e15f991f35ee0e5f2 Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Sun, 12 Nov 2023 17:18:18 +0100 Subject: [PATCH] Radio and TACAN frequencies are now clamped --- client/views/other/dialogs.ejs | 28 ++-------------------------- src/core/src/unit.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/client/views/other/dialogs.ejs b/client/views/other/dialogs.ejs index 738bc97d..9b4c52ae 100644 --- a/client/views/other/dialogs.ejs +++ b/client/views/other/dialogs.ejs @@ -102,30 +102,6 @@ - - -
@@ -144,7 +120,7 @@
- +
@@ -172,7 +148,7 @@
- +
diff --git a/src/core/src/unit.cpp b/src/core/src/unit.cpp index 6bcf1b10..8331b665 100644 --- a/src/core/src/unit.cpp +++ b/src/core/src/unit.cpp @@ -538,6 +538,12 @@ void Unit::setTACAN(DataTypes::TACAN newTACAN, bool force) TACAN = newTACAN; if (TACAN.isOn) { std::ostringstream commandSS; + + if (TACAN.channel < 0) + TACAN.channel = 0; + if (TACAN.channel > 126) + TACAN.channel = 126; + commandSS << "{" << "id = 'ActivateBeacon'," << "params = {" @@ -575,6 +581,12 @@ void Unit::setRadio(DataTypes::Radio newRadio, bool force) std::ostringstream commandSS; Command* command; + if (radio.frequency < 0) + radio.frequency = 0; + + if (radio.frequency > 999000000) + radio.frequency = 999000000; + commandSS << "{" << "id = 'SetFrequency'," << "params = {"