Skip to content

Commit

Permalink
Fix false target id when fire mission is canceled (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timi007 authored Jan 29, 2025
1 parent 4f30367 commit bb85927
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions addons/zeus/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ if (hasInterface) then {

[QGVAR(fireMissionComplete), {
if (isNull curatorCamera) exitWith {};
params ["_targetLogic", "_canceled"];
params ["_id", "_canceled"];
TRACE_2("fireMissionComplete EH",_id,_canceled);

if (_id <= 0) exitWith {};

private _id = _targetLogic getVariable [QGVAR(targetID), 0];
if (_canceled) then {
[LLSTRING(artillery_fireMissionCanceled), _id] call zen_common_fnc_showMessage;
} else {
Expand Down
6 changes: 3 additions & 3 deletions addons/zeus/functions/fnc_execFireMission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ if (_firstImpactDelay > 5) then {
_args params ["_targetLogic", "_t0", "_shellReverseQueue"];

if (_shellReverseQueue isEqualTo [] || isNull _targetLogic) exitWith {
LOG("Fire mission completed normally.");
[_handle] call CBA_fnc_removePerFrameHandler;

if (!isNull _targetLogic) then {
[QGVAR(fireMissionComplete), [_targetLogic, false]] call CBA_fnc_globalEvent;
deleteVehicle _targetLogic;
LOG("Fire mission completed normally.");
_targetLogic setVariable [QGVAR(fireMissionComplete), true, true];
deleteVehicle _targetLogic; // Will trigger deleted EH and broadcast complete event
};
};

Expand Down
6 changes: 5 additions & 1 deletion addons/zeus/functions/fnc_initFireMission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ private _jipID = [QGVAR(visualizeArtyTargetArea), _targetArea] call CBA_fnc_glob
// Handle canceling fire mission
_targetLogic addEventHandler ["Deleted", {
params ["_targetLogic"];
[QGVAR(fireMissionComplete), [_targetLogic, true]] call CBA_fnc_globalEvent;

private _targetID = _targetLogic getVariable [QGVAR(targetID), -1];
private _complete = _targetLogic getVariable [QGVAR(fireMissionComplete), false];

[QGVAR(fireMissionComplete), [_targetID, !_complete]] call CBA_fnc_globalEvent;
}];

// Begin fire mission
Expand Down

0 comments on commit bb85927

Please sign in to comment.