summaryrefslogtreecommitdiffstats
path: root/pacman-c++/sceneholder.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-04-19 22:19:22 +0200
committermanuel <manuel@mausz.at>2011-04-19 22:19:22 +0200
commit11224354131c29f656fb7e5e439c6946aff13458 (patch)
treec86bad0422ef1388ed1fcd32894ea9b0436f82ca /pacman-c++/sceneholder.cpp
parentecd74970a9c9d41637289b3186ae1ffed1d2f7e2 (diff)
parent7a5e71759c00b2c77f7ee3287c366dd1b48b81ca (diff)
downloadfoop-11224354131c29f656fb7e5e439c6946aff13458.tar.gz
foop-11224354131c29f656fb7e5e439c6946aff13458.tar.bz2
foop-11224354131c29f656fb7e5e439c6946aff13458.zip
Merge branch 'master' of ssh://manuel.mausz.at/foop
Diffstat (limited to 'pacman-c++/sceneholder.cpp')
-rw-r--r--pacman-c++/sceneholder.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/pacman-c++/sceneholder.cpp b/pacman-c++/sceneholder.cpp
index dace711..37db691 100644
--- a/pacman-c++/sceneholder.cpp
+++ b/pacman-c++/sceneholder.cpp
@@ -73,8 +73,9 @@ void SceneHolder::updateMap(const Transmission::map_t& map, const unsigned int x
73 } 73 }
74 74
75 /* an item must be removed by an actor */ 75 /* an item must be removed by an actor */
76 if (actor == NULL) 76 if (actor == NULL) {
77 Q_ASSERT(false); 77 Q_ASSERT(false);
78 }
78 oldItem->onDie(actor); 79 oldItem->onDie(actor);
79 80
80 /* register item for removal in next update */ 81 /* register item for removal in next update */
@@ -151,6 +152,11 @@ void SceneHolder::updateMap(const Transmission::map_t& map, const unsigned int x
151 qDebug() << "[SceneUpdate] actor moves: color=" << color 152 qDebug() << "[SceneUpdate] actor moves: color=" << color
152 << "direction=" << direction << "newpos=" << QPoint(x, y); 153 << "direction=" << direction << "newpos=" << QPoint(x, y);
153 } 154 }
155
156 QPoint distance = QPoint(x, y) - CoordToMapPosition(actor->pos().x(), actor->pos().y());
157 if (distance.manhattanLength() > 1) {
158 actor->setPos(mapPositionToCoord(x, y));
159 }
154 } 160 }
155 161
156 if (cur & Transmission::empty) 162 if (cur & Transmission::empty)
@@ -195,6 +201,9 @@ unsigned int SceneHolder::pointsLeft()
195void SceneHolder::decrementPoints() 201void SceneHolder::decrementPoints()
196{ 202{
197 --m_pointsLeft; 203 --m_pointsLeft;
204 if (m_pointsLeft == 0) {
205 emit allPointsRemoved();
206 }
198} 207}
199 208
200void SceneHolder::setEatingOrder(QList<Color::Color> &order) 209void SceneHolder::setEatingOrder(QList<Color::Color> &order)