Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle initPost EH added during PostInit #736

Merged
merged 2 commits into from
Aug 19, 2017

Conversation

PabstMirror
Copy link
Contributor

@PabstMirror PabstMirror commented Aug 18, 2017

Should fix #567

Before:
PreInit Runs
Unit Init runs (unit gets initilized var set)
PostInit Starts
Adds InitPost EH to unit, which would run immediately (PROBLEM).
PostInit finishes by running through GVAR(initPostStack) and run all initPost EHs

@commy2 commy2 added this to the 3.4.1 milestone Aug 18, 2017
@commy2 commy2 self-assigned this Aug 18, 2017
@@ -73,6 +73,8 @@ _entities = _entities arrayIntersect _entities; // entities can return duplicate

//Run initReto now if the unit has already been initialized
if (_applyInitRetroactively && {ISINITIALIZED(_unit)}) then {
// If PostInit has not finisehd exit as it will be run via initPostStack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finisehd

@@ -73,6 +73,8 @@ _entities = _entities arrayIntersect _entities; // entities can return duplicate

//Run initReto now if the unit has already been initialized
if (_applyInitRetroactively && {ISINITIALIZED(_unit)}) then {
// If PostInit has not finisehd exit as it will be run via initPostStack
if ((_eventName == "initpost") && {!(SLX_XEH_MACHINE select 8)}) exitWith {};
Copy link
Contributor

@Dystopian Dystopian Aug 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this condition could be moved to parent if

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ugly:

if (_applyInitRetroactively && {ISINITIALIZED(_unit) && {_eventName != "initPost" || {SLX_XEH_MACHINE select 8}}}) then {

Copy link
Contributor

@commy2 commy2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works

@Killswitch00 Killswitch00 merged commit 85368f8 into master Aug 19, 2017
@Killswitch00 Killswitch00 deleted the handleInitPostAddedDuringPostInit branch August 19, 2017 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XEH initPost runs twice when added retroactively via function
4 participants