From f8b46e859caaa23a3d3373b15218f4232d153b1c Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 3 Apr 2016 23:36:38 -0500 Subject: [PATCH] Wait until postInit to install playerChanged event --- addons/common/XEH_postInit.sqf | 6 ------ addons/common/XEH_preInit.sqf | 19 +------------------ 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 8eeed526f5f..ae1014ddc8b 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -332,12 +332,6 @@ GVAR(OldVisibleMap) = false; GVAR(OldInventoryDisplayIsOpen) = nil; //@todo check this GVAR(OldIsCamera) = false; -// clean up playerChanged eventhandler from preinit and put it in the same PFH as the other events to reduce overhead and guarantee advantageous execution order -if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { - [GVAR(PreInit_playerChanged_PFHID)] call CBA_fnc_removePerFrameHandler; - GVAR(PreInit_playerChanged_PFHID) = nil; -}; - // PFH to raise varios events [{ BEGIN_COUNTER(stateChecker); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 20b3692b9f8..16e0a651596 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -47,29 +47,12 @@ GVAR(statusEffect_Names) = []; GVAR(statusEffect_isGlobal) = []; ////////////////////////////////////////////////// -// Set up PlayerChanged eventhandler for pre init +// Set up PlayerChanged eventhandler for pre init (EH is installed in postInit) ////////////////////////////////////////////////// ACE_player = objNull; uiNamespace setVariable ["ACE_player", objNull]; -// @todo check if this can be removed -if (hasInterface) then { - // PFH to update the ACE_player variable - GVAR(PreInit_playerChanged_PFHID) = [{ - if !(ACE_player isEqualTo (call FUNC(player))) then { - private _oldPlayer = ACE_player; - - ACE_player = call FUNC(player); - uiNamespace setVariable ["ACE_player", ACE_player]; - - // Raise ACE event - ["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent); - }; - }, 0, []] call CBA_fnc_addPerFrameHandler; -}; - - ////////////////////////////////////////////////// // Time handling //////////////////////////////////////////////////