Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

States: possible to accidentally run multiple states at once #393

Open
NicoM1 opened this issue Jul 23, 2016 · 0 comments
Open

States: possible to accidentally run multiple states at once #393

NicoM1 opened this issue Jul 23, 2016 · 0 comments

Comments

@NicoM1
Copy link
Contributor

NicoM1 commented Jul 23, 2016

This bug took me a long time to find:

Do to the order states are initiated in:

    function enter<T>( _state:State, ?_enter_with:T ) {

            //order matters
        _state.onenter( _enter_with );
        active_states.push( _state );
        active_count++;
        _state.active = true;

    } //enter

if you attempt to set() at new state, while in onenter() of the current state, it has not yet been added to the active states, so when it attempts to leave, it actually does nothing, and continues running its update (along with the new states update).

I'm wondering if onenter() should just be called after the other initialisation? don't see why that would be wrong but I haven't delved into any other code of how these run.

I also wonder why there is a list of active states? is there some way of running states concurrently?
(ah oops ignore that one, just saw the enable/disable, leaving to note that their logic also likely allows for these ghost states)

Nico

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant