diff --git a/addons/advanced_fatigue/CfgEden.hpp b/addons/advanced_fatigue/CfgEden.hpp index 8307c8a2a57..5f1ae9dad8e 100644 --- a/addons/advanced_fatigue/CfgEden.hpp +++ b/addons/advanced_fatigue/CfgEden.hpp @@ -2,9 +2,35 @@ class Cfg3DEN { class Attributes { class Slider; class GVAR(slider): Slider { - attributeLoad = "params [""_ctrlGroup""]; private _slider = _ctrlGroup controlsGroupCtrl 100; private _edit = _ctrlGroup controlsGroupCtrl 101; _slider sliderSetPosition _value; _edit ctrlSetText ([_value, 1, 1] call CBA_fnc_formatNumber); "; - attributeSave = "params [""_ctrlGroup""]; sliderPosition (_ctrlGroup controlsGroupCtrl 100); "; - onLoad = "params [""_ctrlGroup""]; private _slider = _ctrlGroup controlsGroupCtrl 100; private _edit = _ctrlGroup controlsGroupCtrl 101; _slider sliderSetRange [0, 2]; _slider ctrlAddEventHandler [""SliderPosChanged"", { params [""_slider""]; private _edit = (ctrlParentControlsGroup _slider) controlsGroupCtrl 101; private _value = sliderPosition _slider; _edit ctrlSetText ([_value, 1, 1] call CBA_fnc_formatNumber); }]; _edit ctrlAddEventHandler [""KillFocus"", { params [""_edit""]; private _slider = (ctrlParentControlsGroup _edit) controlsGroupCtrl 100; private _value = ((parseNumber ctrlText _edit) min 2) max 0; _slider sliderSetPosition _value; _edit ctrlSetText str _value; }];"; + #pragma hemtt suppress pw3_padded_arg + attributeLoad = QUOTE( + params ['_ctrlGroup']; \ + private _slider = _ctrlGroup controlsGroupCtrl 100; \ + private _edit = _ctrlGroup controlsGroupCtrl 101; \ + _slider sliderSetPosition _value; \ + _edit ctrlSetText ([ARR_3(_value,1,1)] call CBA_fnc_formatNumber); \ + ); + attributeSave = QUOTE(params ['_ctrlGroup']; sliderPosition (_ctrlGroup controlsGroupCtrl 100)); + #pragma hemtt suppress pw3_padded_arg + onLoad = QUOTE( + params ['_ctrlGroup']; \ + private _slider = _ctrlGroup controlsGroupCtrl 100; \ + private _edit = _ctrlGroup controlsGroupCtrl 101; \ + _slider sliderSetRange [ARR_2(0,MAX_PERFORMANCE_FACTOR)]; \ + _slider ctrlAddEventHandler [ARR_2('SliderPosChanged',{ \ + params ['_slider']; \ + private _edit = (ctrlParentControlsGroup _slider) controlsGroupCtrl 101; \ + private _value = sliderPosition _slider; \ + _edit ctrlSetText ([ARR_3(_value,1,1)] call CBA_fnc_formatNumber); \ + })]; \ + _edit ctrlAddEventHandler [ARR_2('KillFocus',{ \ + params ['_edit']; \ + private _slider = (ctrlParentControlsGroup _edit) controlsGroupCtrl 100; \ + private _value = ((parseNumber ctrlText _edit) min MAX_PERFORMANCE_FACTOR) max 0; \ + _slider sliderSetPosition _value; \ + _edit ctrlSetText str _value; \ + })]; \ + ); }; }; class Object { diff --git a/addons/advanced_fatigue/initSettings.inc.sqf b/addons/advanced_fatigue/initSettings.inc.sqf index 40d1d08f0d3..bd8bd7d9281 100644 --- a/addons/advanced_fatigue/initSettings.inc.sqf +++ b/addons/advanced_fatigue/initSettings.inc.sqf @@ -43,7 +43,7 @@ "SLIDER", [LSTRING(PerformanceFactor), LSTRING(PerformanceFactor_Description)], LSTRING(DisplayName), - [0, 10, 1, 2], + [0, MAX_PERFORMANCE_FACTOR, 1, 2], 1, { // Recalculate values if the setting is changed mid-mission diff --git a/addons/advanced_fatigue/script_component.hpp b/addons/advanced_fatigue/script_component.hpp index 7e3255439ff..11228ff3f25 100644 --- a/addons/advanced_fatigue/script_component.hpp +++ b/addons/advanced_fatigue/script_component.hpp @@ -41,3 +41,5 @@ #define AE1_MAXRESERVE 4000000 // mmol #define AE2_MAXRESERVE 84000 // mmol #define AN_MAXRESERVE 2300 // mmol + +#define MAX_PERFORMANCE_FACTOR 10