Merge pull request #3658 from acemod/fixPlayerChangedEvent

Wait until postInit to install playerChanged event
This commit is contained in:
commy2 2016-04-04 07:56:13 +02:00
commit a8c0840cd1
2 changed files with 1 additions and 24 deletions

View File

@ -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);

View File

@ -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
//////////////////////////////////////////////////