From a1132ec93b7e5aaac7b23fef66bd08427a51cdd5 Mon Sep 17 00:00:00 2001 From: McDiod Date: Sun, 7 Jul 2019 17:53:18 +0200 Subject: [PATCH] add failure code argument to fnc_progressBar (#1177) --- addons/ui/fnc_progressBar.sqf | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/ui/fnc_progressBar.sqf b/addons/ui/fnc_progressBar.sqf index 1042bc69c..074f22c8e 100644 --- a/addons/ui/fnc_progressBar.sqf +++ b/addons/ui/fnc_progressBar.sqf @@ -25,6 +25,11 @@ Arguments: #1 - true: success, false: failure #2 - elapsed time, not more than _totalTime #3 - total time, same as _totalTime + #4 - failure code + 0 - no failure + 1 - user hit ESC key + 2 - condition was false + 3 - progressbar closed by new progressbar Returns: Nothing @@ -75,7 +80,7 @@ if (!isNil QGVAR(ProgressBarParams)) then { GVAR(ProgressBarParams) params ["_arguments", "", "", "_onFailure", "_startTime", "_totalTime"]; private _elapsedTime = (CBA_missionTime - _startTime) min _totalTime; - [_onFailure, [_arguments, false, _elapsedTime, _totalTime]] call CBA_fnc_execNextFrame; + [_onFailure, [_arguments, false, _elapsedTime, _totalTime, 3]] call CBA_fnc_execNextFrame; }; GVAR(ProgressBarParams) = [_arguments, _condition, _onSuccess, _onFailure, CBA_missionTime, _totalTime, _blockMouse, _blockKeys, _allowClose]; @@ -101,14 +106,14 @@ _ctrlScript ctrlAddEventHandler ["Draw", { GVAR(ProgressBarParams) = nil; {QGVAR(ProgressBar) cutText ["", "PLAIN"]} call CBA_fnc_execNextFrame; // game would crash if display is killed from Draw event _blockInputDisplay closeDisplay 0; - [_onFailure, [_arguments, false, _elapsedTime, _totalTime]] call CBA_fnc_execNextFrame; + [_onFailure, [_arguments, false, _elapsedTime, _totalTime, 2]] call CBA_fnc_execNextFrame; }; if (_elapsedTime >= _totalTime) exitWith { GVAR(ProgressBarParams) = nil; {QGVAR(ProgressBar) cutText ["", "PLAIN"]} call CBA_fnc_execNextFrame; // game would crash if display is killed from Draw event _blockInputDisplay closeDisplay 0; - [_onSuccess, [_arguments, true, _elapsedTime, _totalTime]] call CBA_fnc_execNextFrame; + [_onSuccess, [_arguments, true, _elapsedTime, _totalTime, 0]] call CBA_fnc_execNextFrame; }; private _ctrlBar = _display displayCtrl IDC_PROGRESSBAR_BAR; @@ -135,7 +140,7 @@ if (_blockMouse) then { GVAR(ProgressBarParams) = nil; QGVAR(ProgressBar) cutText ["", "PLAIN"]; _blockInputDisplay closeDisplay 0; - [_onFailure, [_arguments, false, _elapsedTime, _totalTime]] call CBA_fnc_execNextFrame; + [_onFailure, [_arguments, false, _elapsedTime, _totalTime, 1]] call CBA_fnc_execNextFrame; _blockKeys = false; } else {