summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-14 08:59:00 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-14 08:59:00 (GMT)
commitfa99a2ab12f646d73498b69fae0020da1abf9685 (patch)
tree6683bb054f34e85aad2bddaa797582c5bb872695 /examples
parent66d8ad206cca48d8193785bdf685f5d1fba80f02 (diff)
downloadQt-fa99a2ab12f646d73498b69fae0020da1abf9685.zip
Qt-fa99a2ab12f646d73498b69fae0020da1abf9685.tar.gz
Qt-fa99a2ab12f646d73498b69fae0020da1abf9685.tar.bz2
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')
-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 2835988..597f8595 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);
}