summaryrefslogtreecommitdiff
path: root/examples/statemachine
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-14 10:59:00 +0200
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-14 10:59:00 +0200
commitfa99a2ab12f646d73498b69fae0020da1abf9685 (patch)
tree6683bb054f34e85aad2bddaa797582c5bb872695 /examples/statemachine
parent66d8ad206cca48d8193785bdf685f5d1fba80f02 (diff)
downloadqt4-tools-fa99a2ab12f646d73498b69fae0020da1abf9685.tar.gz
Fix run-time error in Seek AI's state machine
Passed parent as 'tank', thus getting a null parent in the GoToLocation state, which breaks the machine when you transition into the state.
Diffstat (limited to 'examples/statemachine')
-rw-r--r--examples/statemachine/tankgameplugins/seek_ai/seek_ai.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
index 2835988799..597f859581 100644
--- a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
+++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
@@ -137,16 +137,20 @@ public:
ChaseState(QObject *tank, QState *parentState = 0) : QState(parentState), m_tank(tank)
{
QState *fireCannon = new QState(this);
+ fireCannon->setObjectName("fireCannon");
connect(fireCannon, SIGNAL(entered()), tank, SLOT(fireCannon()));
setInitialState(fireCannon);
- m_goToLocation = new GoToLocationState(this);
+ m_goToLocation = new GoToLocationState(tank, this);
+ m_goToLocation->setObjectName("goToLocation");
fireCannon->addTransition(tank, SIGNAL(actionCompleted()), m_goToLocation);
m_turnToDirection = new QState(this);
+ m_turnToDirection->setObjectName("turnToDirection");
m_goToLocation->addTransition(tank, SIGNAL(actionCompleted()), m_turnToDirection);
QFinalState *finalState = new QFinalState(this);
+ finalState->setObjectName("finalState");
m_turnToDirection->addTransition(tank, SIGNAL(actionCompleted()), finalState);
}