From 008602590cdc1c8601224ee27d09636b7010e404 Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 6 Nov 2017 17:24:21 +0100 Subject: [PATCH] Fixes bugs in newly added macro based MRAD/MOA conversion * Fixes: 5729 --- .../atragmx/functions/fnc_calculate_truing_drop.sqf | 4 ++-- addons/atragmx/script_component.hpp | 12 ++++++------ addons/ballistics/script_component.hpp | 2 +- addons/rangecard/script_component.hpp | 12 ++++++------ addons/scopes/script_component.hpp | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/addons/atragmx/functions/fnc_calculate_truing_drop.sqf b/addons/atragmx/functions/fnc_calculate_truing_drop.sqf index b21e3b0cba..fa43ac73c2 100644 --- a/addons/atragmx/functions/fnc_calculate_truing_drop.sqf +++ b/addons/atragmx/functions/fnc_calculate_truing_drop.sqf @@ -46,8 +46,8 @@ if (_parseInput) then { }; switch (_dropUnit) do { case 0: { - _transonicDrop = MOA_TO_MRAD(_transonicDrop); - _subsonicDrop = MOA_TO_MRAD(_subsonicDrop); + _transonicDrop = MRAD_TO_MOA(_transonicDrop); + _subsonicDrop = MRAD_TO_MOA(_subsonicDrop); }; case 2: { _transonicDrop = _transonicDrop / 1.047; diff --git a/addons/atragmx/script_component.hpp b/addons/atragmx/script_component.hpp index cc7a4fefd9..f463be7c5b 100644 --- a/addons/atragmx/script_component.hpp +++ b/addons/atragmx/script_component.hpp @@ -16,11 +16,11 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define MRAD_TO_MOA(d) (d * 3.43774677) // Conversion factor: 54 / (5 * PI) -#define MOA_TO_MRAD(d) (d * 0.29088821) // Conversion factor: (5 * PI) / 54 -#define DEG_TO_MOA(d) (d * 60) // Conversion factor: 60 -#define MOA_TO_DEG(d) (d / 60) // Conversion factor: 1 / 60 -#define DEG_TO_MRAD(d) (d * 17.45329252) // Conversion factor: (50 * PI) / 9 -#define MRAD_TO_DEG(d) (d / 17.45329252) // Conversion factor: 9 / (50 * PI) +#define MRAD_TO_MOA(d) ((d) * 3.43774677) // Conversion factor: 54 / (5 * PI) +#define MOA_TO_MRAD(d) ((d) * 0.29088821) // Conversion factor: (5 * PI) / 54 +#define DEG_TO_MOA(d) ((d) * 60) // Conversion factor: 60 +#define MOA_TO_DEG(d) ((d) / 60) // Conversion factor: 1 / 60 +#define DEG_TO_MRAD(d) ((d) * 17.45329252) // Conversion factor: (50 * PI) / 9 +#define MRAD_TO_DEG(d) ((d) / 17.45329252) // Conversion factor: 9 / (50 * PI) #define ATRAGMX_PROFILE_NAMESPACE_VERSION 2.2 diff --git a/addons/ballistics/script_component.hpp b/addons/ballistics/script_component.hpp index 969f340063..c400c48de9 100644 --- a/addons/ballistics/script_component.hpp +++ b/addons/ballistics/script_component.hpp @@ -16,4 +16,4 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define MOA_TO_RAD(d) (d * 0.00029088) // Conversion factor: PI / 10800 +#define MOA_TO_RAD(d) ((d) * 0.00029088) // Conversion factor: PI / 10800 diff --git a/addons/rangecard/script_component.hpp b/addons/rangecard/script_component.hpp index 8a3f3825a9..7a9768c15e 100644 --- a/addons/rangecard/script_component.hpp +++ b/addons/rangecard/script_component.hpp @@ -16,9 +16,9 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define MRAD_TO_MOA(d) (d * 3.43774677) // Conversion factor: 54 / (5 * PI) -#define MOA_TO_MRAD(d) (d * 0.29088821) // Conversion factor: (5 * PI) / 54 -#define DEG_TO_MOA(d) (d * 60) // Conversion factor: 60 -#define MOA_TO_DEG(d) (d / 60) // Conversion factor: 1 / 60 -#define DEG_TO_MRAD(d) (d * 17.45329252) // Conversion factor: (50 * PI) / 9 -#define MRAD_TO_DEG(d) (d / 17.45329252) // Conversion factor: 9 / (50 * PI) +#define MRAD_TO_MOA(d) ((d) * 3.43774677) // Conversion factor: 54 / (5 * PI) +#define MOA_TO_MRAD(d) ((d) * 0.29088821) // Conversion factor: (5 * PI) / 54 +#define DEG_TO_MOA(d) ((d) * 60) // Conversion factor: 60 +#define MOA_TO_DEG(d) ((d) / 60) // Conversion factor: 1 / 60 +#define DEG_TO_MRAD(d) ((d) * 17.45329252) // Conversion factor: (50 * PI) / 9 +#define MRAD_TO_DEG(d) ((d) / 17.45329252) // Conversion factor: 9 / (50 * PI) diff --git a/addons/scopes/script_component.hpp b/addons/scopes/script_component.hpp index cc6acebc98..c2f30be00b 100644 --- a/addons/scopes/script_component.hpp +++ b/addons/scopes/script_component.hpp @@ -22,6 +22,6 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_SCOPES #endif -#define MRAD_TO_DEG(d) (d / 17.45329252) // Conversion factor: 9 / (50 * PI) +#define MRAD_TO_DEG(d) ((d) / 17.45329252) // Conversion factor: 9 / (50 * PI) #include "\z\ace\addons\main\script_macros.hpp"