Fortify - Fix funds being lost when canceling deploy (#8992)

This commit is contained in:
Whigital 2022-08-17 12:59:07 +02:00 committed by GitHub
parent 131b0b9472
commit 286537cd54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -76,7 +76,7 @@ GVAR(objectRotationZ) = 0;
// Place object event handler // Place object event handler
[QGVAR(deployFinished), { [QGVAR(deployFinished), {
params ["_args", "_elapsedTime", "_totalTime", "_errorCode"]; params ["_args", "_elapsedTime", "_totalTime", "_errorCode"];
_args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp"]; _args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp", "_cost"];
private _newObject = _typeOf createVehicle _posASL; private _newObject = _typeOf createVehicle _posASL;
_newObject setPosASL _posASL; _newObject setPosASL _posASL;
@ -96,7 +96,10 @@ GVAR(objectRotationZ) = 0;
[QGVAR(deployCanceled), { [QGVAR(deployCanceled), {
params ["_args", "_elapsedTime", "_totalTime", "_errorCode"]; params ["_args", "_elapsedTime", "_totalTime", "_errorCode"];
_args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp"]; _args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp", "_cost"];
// Refund if deploy was canceled
[_side, _cost] call FUNC(updateBudget);
// Reset animation // Reset animation
[_unit, "", 1] call EFUNC(common,doAnimation); [_unit, "", 1] call EFUNC(common,doAnimation);

View File

@ -20,10 +20,10 @@ params ["_unit", "_object"];
TRACE_2("deployConfirm",_unit,_object); TRACE_2("deployConfirm",_unit,_object);
private _side = side group _unit; private _side = side group _unit;
private _cost = [_side, typeOf _object] call FUNC(getCost); private _typeOf = typeOf _object;
private _cost = [_side, _typeOf] call FUNC(getCost);
[_side, -_cost] call FUNC(updateBudget); [_side, -_cost] call FUNC(updateBudget);
private _typeOf = typeOf _object;
private _posASL = getPosASL _object; private _posASL = getPosASL _object;
private _vectorUp = vectorUp _object; private _vectorUp = vectorUp _object;
private _vectorDir = vectorDir _object; private _vectorDir = vectorDir _object;
@ -35,7 +35,7 @@ private _totalTime = _cost * GVAR(timeCostCoefficient) + GVAR(timeMin); // time
private _perframeCheck = { private _perframeCheck = {
params ["_args", "_elapsedTime", "_totalTime", "_errorCode"]; params ["_args", "_elapsedTime", "_totalTime", "_errorCode"];
_args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp"]; _args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp", "_cost"];
// Animation loop (required for longer constructions) // Animation loop (required for longer constructions)
if (animationState _unit isNotEqualTo "AinvPknlMstpSnonWnonDnon_medic4") then { if (animationState _unit isNotEqualTo "AinvPknlMstpSnonWnonDnon_medic4") then {
@ -49,7 +49,7 @@ private _perframeCheck = {
[ [
_totalTime, _totalTime,
[_unit, _side, _typeOf, _posASL, _vectorDir, _vectorUp], [_unit, _side, _typeOf, _posASL, _vectorDir, _vectorUp, _cost],
QGVAR(deployFinished), QGVAR(deployFinished),
QGVAR(deployCanceled), QGVAR(deployCanceled),
LLSTRING(progressBarTitle), LLSTRING(progressBarTitle),