I'm evaluating Boost.Statechart for possible use in a turn-based strategy type game. It's very promising so far, I just would just like a little clarification on a few things.
1. Is there a clean way to seperate the definition of a state from the definition of its initial inner state? Say we have
// StatePlayGame.h
#include "MyStateMachine.h"
class StateGameStartup;
class StatePlayGame : public boost::statechart::state<StatePlayGame, MyStateMachine, StateGameStartup>
{
//...
};
// StateGameStartup.h
#include "StatePlayGame.h"
class StateGameStartup : public boost::statechart::state<StateGameStartup, StatePlayGame>
{
//...
};
It appears that any translation unit that includes StatePlayGame.h also requires StateGameStartup.h in order to compile - obviously a less than ideal situation.
2. Is it possible to pass parameters to a state's constructor? Going with the little example above let's say that StateGameStartup asks the player how many enemies he wants to fight, and then transitions to StateGameRunning, which needs that number. Can it be passed by StateGameRunning's ctor or is it just required that states can only share information via their context?
Cheers,
MC