diff --git a/addons/arsenal/missions/Arsenal.VR/script_component.hpp b/addons/arsenal/missions/Arsenal.VR/script_component.hpp index 7447e1c87f..5053d168dd 100644 --- a/addons/arsenal/missions/Arsenal.VR/script_component.hpp +++ b/addons/arsenal/missions/Arsenal.VR/script_component.hpp @@ -1,4 +1,5 @@ #include "\z\ace\addons\arsenal\script_component.hpp" +// make.py can't redefine already defined macros #undef PREP #define PREP(var) FUNC(var) = compileFinal preprocessFileLineNumbers format ["fnc_%1.sqf", QUOTE(var)] diff --git a/addons/units/config.cpp b/addons/units/config.cpp index 5b257acaf3..54792709f4 100644 --- a/addons/units/config.cpp +++ b/addons/units/config.cpp @@ -32,7 +32,7 @@ class GVAR(alt): RscText { colorText[] = {"(profileNamespace getVariable ['IGUI_TEXT_RGB_R',0])","(profileNamespace getVariable ['IGUI_TEXT_RGB_G',1])","(profileNamespace getVariable ['IGUI_TEXT_RGB_B',1])","(profileNamespace getVariable ['IGUI_TEXT_RGB_A',0.8])"}; text = "9999"; x = 6.3 * GUI_GRID_W + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_X", (safezoneX + 0.5 * GUI_GRID_W)]); - y = 2.3 * GUI_GRID_H + (profileNamespace getVariable [""IGUI_GRID_VEHICLE_Y"", (safezoneY + 0.5 * GUI_GRID_H)]); + y = 2.3 * GUI_GRID_H + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_Y", (safezoneY + 0.5 * GUI_GRID_H)]); w = 2 * GUI_GRID_W; h = 1 * GUI_GRID_H; sizeEx = 0.8 * GUI_GRID_H; diff --git a/addons/units/functions/fnc_altInfo.sqf b/addons/units/functions/fnc_altInfo.sqf index c402eeb218..2a5aa54b3d 100644 --- a/addons/units/functions/fnc_altInfo.sqf +++ b/addons/units/functions/fnc_altInfo.sqf @@ -2,6 +2,6 @@ params ["_unit"]; -if (_unit isEqualTo ALT_F) exitWith {["f", 0.3047999902464003]}; +if (_unit isEqualTo ALT_F) exitWith {["f", METERS_TO_FEET]}; ["m", 1] diff --git a/addons/units/functions/fnc_onAltLoad.sqf b/addons/units/functions/fnc_onAltLoad.sqf index 9b12ee9b7f..0c5a75377a 100644 --- a/addons/units/functions/fnc_onAltLoad.sqf +++ b/addons/units/functions/fnc_onAltLoad.sqf @@ -5,18 +5,18 @@ params ["_ctrl"]; private _alt = (ctrlParent _ctrl) ctrlCreate [QGVAR(alt), -1]; private _units = (vehicle ACE_player) call FUNC(altUnits); -private _altInfo = _units call FUNC(altInfo); +_units call FUNC(altInfo) params ["_unitText", "_ratio"]; -((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); -GVAR(altRatio) = _altInfo select 1; +((ctrlParent _alt) displayCtrl 1005) ctrlSetText _unitText; +GVAR(altRatio) = _ratio; private _settingEH = ["CBA_SettingChanged", { params ["_setting", "_value"]; _thisArgs params ["_settingName", "_alt"]; if (_setting isEqualTo _settingName) then { - private _altInfo = [_value] call FUNC(altInfo); - ((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); - GVAR(altRatio) = _altInfo select 1; + [_value] call FUNC(altInfo) params ["_unitText", "_ratio"]; + ((ctrlParent _alt) displayCtrl 1005) ctrlSetText _unitText; + GVAR(altRatio) = _ratio; }; }, [_units select 1, _alt]] call CBA_fnc_addEventHandlerArgs; diff --git a/addons/units/functions/fnc_onSpeedLoad.sqf b/addons/units/functions/fnc_onSpeedLoad.sqf index b87b7b1975..f2094bca23 100644 --- a/addons/units/functions/fnc_onSpeedLoad.sqf +++ b/addons/units/functions/fnc_onSpeedLoad.sqf @@ -5,18 +5,18 @@ params ["_ctrl"]; private _speed = (ctrlParent _ctrl) ctrlCreate [QGVAR(speed), -1]; private _units = (vehicle ACE_player) call FUNC(speedUnits); -private _speedInfo = _units call FUNC(speedInfo); +_units call FUNC(speedInfo) params ["_unitText", "_ratio"]; -((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); -GVAR(speedRatio) = _speedInfo select 1; +((ctrlParent _speed) displayCtrl 1004) ctrlSetText _unitText; +GVAR(speedRatio) = _ratio; private _settingEH = ["CBA_SettingChanged", { params ["_setting", "_value"]; _thisArgs params ["_settingName", "_speed"]; if (_setting isEqualTo _settingName) then { - private _speedInfo = [_value] call FUNC(speedInfo); - ((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); - GVAR(speedRatio) = _speedInfo select 1; + [_value] call FUNC(speedInfo) params ["_unitText", "_ratio"]; + ((ctrlParent _speed) displayCtrl 1004) ctrlSetText _unitText; + GVAR(speedRatio) = _ratio; }; }, [_units select 1, _speed]] call CBA_fnc_addEventHandlerArgs; diff --git a/addons/units/functions/fnc_speedInfo.sqf b/addons/units/functions/fnc_speedInfo.sqf index 698eaf3839..91744043f3 100644 --- a/addons/units/functions/fnc_speedInfo.sqf +++ b/addons/units/functions/fnc_speedInfo.sqf @@ -2,8 +2,8 @@ params ["_unit"]; -if (_unit isEqualTo SPEED_MPH) exitWith {[LLSTRING(Speed_MPH), 1.609]}; -if (_unit isEqualTo SPEED_KNOT) exitWith {[LLSTRING(Speed_KNOT), 1.852]}; -if (_unit isEqualTo SPEED_MS) exitWith {[LLSTRING(Speed_MS), 3.6]}; +if (_unit isEqualTo SPEED_MPH) exitWith {[LLSTRING(Speed_MPH), KMH_TO_MPH]}; +if (_unit isEqualTo SPEED_KNOT) exitWith {[LLSTRING(Speed_KNOT), KMH_TO_KNOT]}; +if (_unit isEqualTo SPEED_MS) exitWith {[LLSTRING(Speed_MS), KMH_TO_MS]}; [LLSTRING(Speed_KMH), 1] diff --git a/addons/units/script_component.hpp b/addons/units/script_component.hpp index 1e082bd901..e238b9480e 100644 --- a/addons/units/script_component.hpp +++ b/addons/units/script_component.hpp @@ -16,9 +16,15 @@ #define SPEED_KNOT 2 #define SPEED_MS 3 +#define KMH_TO_MPH 1.609 +#define KMH_TO_KNOT 1.852 +#define KMH_TO_MS 3.6 + #define ALT_M 0 #define ALT_F 1 +#define METERS_TO_FEET 0.3047999902464003 + #define MODE_ATL 0 #define MODE_ASL 1