Skip to content

Commit

Permalink
Fix 3DEN event handler added multiple times (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timi007 authored Jan 16, 2025
1 parent 15aaa88 commit 923662d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 8 additions & 0 deletions addons/zeus/Cfg3DEN.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ class Cfg3DEN {
};
};
};

class EventHandlers {
class ADDON {
// Arguments are for debugging
onMissionSave = QUOTE([false] call FUNC(on3DENMissionSave));
onMissionAutosave = QUOTE([true] call FUNC(on3DENMissionSave));
};
};
};
6 changes: 0 additions & 6 deletions addons/zeus/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,3 @@ _displayNames = [
getText (_cfgVehicles >> "SatchelCharge_F" >> "displayName")
] + _displayNames;
GVAR(chargeCache) = [_configNames, _displayNames];

// For 3DEN comments in Zeus
if (is3DEN) then {
add3DENEventHandler ["OnMissionSave", {[false] call FUNC(on3DENMissionSave)}];
add3DENEventHandler ["OnMissionAutosave", {[true] call FUNC(on3DENMissionSave)}];
};
6 changes: 2 additions & 4 deletions addons/zeus/functions/fnc_on3DENMissionSave.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ TRACE_1("3DEN Mission saved",_isAutosave);

private _3denComments = [];
{
if (_x isEqualTo -999) then {
continue;
};
if (_x isEqualTo -999) then {continue};

private _name = (_x get3DENAttribute "name") select 0;
private _description = (_x get3DENAttribute "description") select 0;
private _positionASL = (_x get3DENAttribute "position") select 0;

_3denComments pushBack [_x, _name, _description, _positionASL];
} forEach (all3DENEntities param [7, []]);
} forEach (all3DENEntities select 7);

TRACE_1("Saving comments",_3denComments);

Expand Down

0 comments on commit 923662d

Please sign in to comment.