Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/*
Expand Down
2 changes: 1 addition & 1 deletion src/State.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/StateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down