summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/errorstate
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-05 11:48:24 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-05 11:48:24 (GMT)
commitd388730da773c46f228894186c29d330a774b72b (patch)
treee63eee0b17103018afa433a384f2256affdc7921 /examples/statemachine/errorstate
parente2cb1fe3f71a0fd74c49af2fc451a1e05ed2742b (diff)
downloadQt-d388730da773c46f228894186c29d330a774b72b.zip
Qt-d388730da773c46f228894186c29d330a774b72b.tar.gz
Qt-d388730da773c46f228894186c29d330a774b72b.tar.bz2
Fix support reverse actions. Logic was broken and would always return false
immediately for reverse actions, thus immediately stopping them.
Diffstat (limited to 'examples/statemachine/errorstate')
-rw-r--r--examples/statemachine/errorstate/tankitem.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/statemachine/errorstate/tankitem.cpp b/examples/statemachine/errorstate/tankitem.cpp
index 1e02171..fc71ef9 100644
--- a/examples/statemachine/errorstate/tankitem.cpp
+++ b/examples/statemachine/errorstate/tankitem.cpp
@@ -41,7 +41,7 @@ public:
m_distance -= dist;
if (m_reverse && m_distance > 0.0)
return false;
- else if (m_distance < 0.0)
+ else if (!m_reverse && m_distance < 0.0)
return false;
qreal a = item()->direction() * M_PI / 180.0;
@@ -73,7 +73,7 @@ public:
m_distance -= dist;
if (m_reverse && m_distance > 0.0)
return false;
- else if (m_distance < 0.0)
+ else if (!m_reverse && m_distance < 0.0)
return false;
item()->setDirection(item()->direction() + dist);