From 58ba349f19f98fe3af5332188f5d3dfe4d076807 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 19 Apr 2011 23:03:50 +0200 Subject: nicer method of ending rounds --- pacman-c++/sceneholder.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'pacman-c++/sceneholder.cpp') 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 qDebug() << "[SceneUpdate] actor moves: color=" << color << "direction=" << direction << "newpos=" << QPoint(x, y); } - - QPoint distance = QPoint(x, y) - CoordToMapPosition(actor->pos().x(), actor->pos().y()); - if (distance.manhattanLength() > 1) { - actor->setPos(mapPositionToCoord(x, y)); - } } if (cur & Transmission::empty) @@ -213,6 +208,16 @@ QList &SceneHolder::eatingOrder() return m_eatingorder; } +void SceneHolder::removeActors() +{ + foreach(Actor *actor, m_actors) + { + removeItem(actor); + delete actor; + } + m_actors.clear(); +} + QPoint SceneHolder::mapPositionToCoord(unsigned int x, unsigned int y) { return QPoint(x * Constants::field_size.width, y * Constants::field_size.height); @@ -232,4 +237,3 @@ QPoint SceneHolder::CoordToMapPosition(QPoint point) { return CoordToMapPosition(point.x(), point.y()); } - -- cgit v1.2.3