diff --git a/src/State.cpp b/src/State.cpp index b8ed521..e9e1d59 100644 --- a/src/State.cpp +++ b/src/State.cpp @@ -56,9 +56,8 @@ int State::evalTransitions(){ * all available transitions. The transition that * returns true is returned. */ -int State::execute(){ +void State::execute(){ stateLogic(); - return evalTransitions(); } /* diff --git a/src/State.h b/src/State.h index a13b237..a75aafe 100644 --- a/src/State.h +++ b/src/State.h @@ -27,7 +27,7 @@ class State{ void addTransition(bool (*c)(), State* s); void addTransition(bool (*c)(), int stateNumber); int evalTransitions(); - int execute(); + void execute(); int setTransition(int index, int stateNumber); //Can now dynamically set the transition // stateLogic is the pointer to the function diff --git a/src/StateMachine.cpp b/src/StateMachine.cpp index 116ba43..d9b3287 100644 --- a/src/StateMachine.cpp +++ b/src/StateMachine.cpp @@ -28,7 +28,8 @@ void StateMachine::run(){ // if it wasnt't changed in state logic. If it was, we // should ignore predefined transitions. int initialState = currentState; - int next = stateList->get(currentState)->execute(); + stateList->get(currentState)->execute(); + int next = stateList->get(currentState)->evalTransitions(); if(initialState == currentState){ executeOnce = (currentState == next)?false:true; currentState = next;