Boost logo

Boost Users :

Subject: [Boost-users] [statechart] Several questions
From: Michael Crawford (mbcrawfo_at_[hidden])
Date: 2009-05-04 17:51:16


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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net