summaryrefslogtreecommitdiffstats
path: root/pacman-c++/sceneholder.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-04-19 23:03:50 +0200
committermanuel <manuel@mausz.at>2011-04-19 23:03:50 +0200
commit58ba349f19f98fe3af5332188f5d3dfe4d076807 (patch)
tree6425c4c8e0bc033906c944b985655625ebd9e19d /pacman-c++/sceneholder.cpp
parent9e9bc7cd492bf6f897bc26818674a3919431fb99 (diff)
downloadfoop-58ba349f19f98fe3af5332188f5d3dfe4d076807.tar.gz
foop-58ba349f19f98fe3af5332188f5d3dfe4d076807.tar.bz2
foop-58ba349f19f98fe3af5332188f5d3dfe4d076807.zip
nicer method of ending rounds
Diffstat (limited to 'pacman-c++/sceneholder.cpp')
-rw-r--r--pacman-c++/sceneholder.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/pacman-c++/sceneholder.cpp b/pacman-c++/sceneholder.cpp
index 03abf7f..1610b7e 100644
--- a/pacman-c++/sceneholder.cpp
+++ b/pacman-c++/sceneholder.cpp
@@ -150,11 +150,6 @@ void SceneHolder::updateMap(const Transmission::map_t& map, const unsigned int x
150 qDebug() << "[SceneUpdate] actor moves: color=" << color 150 qDebug() << "[SceneUpdate] actor moves: color=" << color
151 << "direction=" << direction << "newpos=" << QPoint(x, y); 151 << "direction=" << direction << "newpos=" << QPoint(x, y);
152 } 152 }
153
154 QPoint distance = QPoint(x, y) - CoordToMapPosition(actor->pos().x(), actor->pos().y());
155 if (distance.manhattanLength() > 1) {
156 actor->setPos(mapPositionToCoord(x, y));
157 }
158 } 153 }
159 154
160 if (cur & Transmission::empty) 155 if (cur & Transmission::empty)
@@ -213,6 +208,16 @@ QList<Color::Color> &SceneHolder::eatingOrder()
213 return m_eatingorder; 208 return m_eatingorder;
214} 209}
215 210
211void SceneHolder::removeActors()
212{
213 foreach(Actor *actor, m_actors)
214 {
215 removeItem(actor);
216 delete actor;
217 }
218 m_actors.clear();
219}
220
216QPoint SceneHolder::mapPositionToCoord(unsigned int x, unsigned int y) 221QPoint SceneHolder::mapPositionToCoord(unsigned int x, unsigned int y)
217{ 222{
218 return QPoint(x * Constants::field_size.width, y * Constants::field_size.height); 223 return QPoint(x * Constants::field_size.width, y * Constants::field_size.height);
@@ -232,4 +237,3 @@ QPoint SceneHolder::CoordToMapPosition(QPoint point)
232{ 237{
233 return CoordToMapPosition(point.x(), point.y()); 238 return CoordToMapPosition(point.x(), point.y());
234} 239}
235