From 923662de367e0475e59aa3e6a11edb33e2f4390d Mon Sep 17 00:00:00 2001 From: Timi007 Date: Thu, 16 Jan 2025 21:58:02 +0100 Subject: [PATCH] Fix 3DEN event handler added multiple times (#123) --- addons/zeus/Cfg3DEN.hpp | 8 ++++++++ addons/zeus/XEH_preInit.sqf | 6 ------ addons/zeus/functions/fnc_on3DENMissionSave.sqf | 6 ++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/zeus/Cfg3DEN.hpp b/addons/zeus/Cfg3DEN.hpp index 9a4365f..3fed978 100644 --- a/addons/zeus/Cfg3DEN.hpp +++ b/addons/zeus/Cfg3DEN.hpp @@ -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)); + }; + }; }; diff --git a/addons/zeus/XEH_preInit.sqf b/addons/zeus/XEH_preInit.sqf index 44dd340..6049787 100644 --- a/addons/zeus/XEH_preInit.sqf +++ b/addons/zeus/XEH_preInit.sqf @@ -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)}]; -}; diff --git a/addons/zeus/functions/fnc_on3DENMissionSave.sqf b/addons/zeus/functions/fnc_on3DENMissionSave.sqf index 3bfb9c4..6b7c0c4 100644 --- a/addons/zeus/functions/fnc_on3DENMissionSave.sqf +++ b/addons/zeus/functions/fnc_on3DENMissionSave.sqf @@ -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);