From 5b4f52da509059ecd2cb09fc8c86c0eb1aaa715d Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 6 Mar 2016 07:32:24 +0100 Subject: [PATCH] always execute XEH preInit in 3den, fix #292 --- addons/xeh/CfgEventHandlers.hpp | 5 +++-- addons/xeh/XEH_interruptDisplayLoad.sqf | 11 ----------- addons/xeh/fnc_preInit.sqf | 7 +++---- 3 files changed, 6 insertions(+), 17 deletions(-) delete mode 100644 addons/xeh/XEH_interruptDisplayLoad.sqf diff --git a/addons/xeh/CfgEventHandlers.hpp b/addons/xeh/CfgEventHandlers.hpp index 22f5ef03a..f34ec4ea3 100644 --- a/addons/xeh/CfgEventHandlers.hpp +++ b/addons/xeh/CfgEventHandlers.hpp @@ -76,8 +76,9 @@ class Extended_WeaponDisassembled_EventHandlers {}; // display xeh class Extended_DisplayLoad_EventHandlers { - class RscDisplayInterrupt { - GVAR(3denFix) = QUOTE(call COMPILE_FILE(XEH_interruptDisplayLoad)); + // fix for preInit = 1 functions not being executed when entering 3den from main menu + class Display3DEN { + ADDON = "[] call CBA_fnc_preInit;"; }; }; class Extended_DisplayUnload_EventHandlers {}; diff --git a/addons/xeh/XEH_interruptDisplayLoad.sqf b/addons/xeh/XEH_interruptDisplayLoad.sqf deleted file mode 100644 index 231b59510..000000000 --- a/addons/xeh/XEH_interruptDisplayLoad.sqf +++ /dev/null @@ -1,11 +0,0 @@ -#include "script_component.hpp" - -disableSerialization; - -params ["_display"]; - -private _ctrl = _display displayCtrl 104; - -if (ctrlText _ctrl == localize "STR_3DEN_RscDisplayInterrupt_ButtonAbort_3DEN_text") then { - _ctrl ctrlAddEventHandler ["buttonClick", {uiNamespace setVariable [QGVAR(3denFix), true]}]; -}; diff --git a/addons/xeh/fnc_preInit.sqf b/addons/xeh/fnc_preInit.sqf index 1b50f25a2..de526c1e6 100644 --- a/addons/xeh/fnc_preInit.sqf +++ b/addons/xeh/fnc_preInit.sqf @@ -16,11 +16,10 @@ Author: ---------------------------------------------------------------------------- */ #include "script_component.hpp" -// hack to fix 3den executing preInit unnecessarily when returning from a preview -if (uiNamespace getVariable [QGVAR(3denFix), false]) exitWith { - uiNamespace setVariable [QGVAR(3denFix), false]; - diag_log text "[XEH]: 3den preview detected. Abort preInit."; +if (ISPROCESSED(missionNamespace)) exitWith { + diag_log text "[XEH]: preInit already executed. Abort preInit."; }; +SETPROCESSED(missionNamespace); SLX_XEH_DisableLogging = uiNamespace getVariable ["SLX_XEH_DisableLogging", false]; // get from preStart