From eaf133fd08c9708fe718ef47451bed7ea803a46a Mon Sep 17 00:00:00 2001 From: totycro Date: Tue, 19 Apr 2011 21:56:37 +0200 Subject: Added rounds rounds will end when all points are removed TODO: end round when a pacman gets eaten --- pacman-c++/sceneholder.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'pacman-c++/sceneholder.cpp') diff --git a/pacman-c++/sceneholder.cpp b/pacman-c++/sceneholder.cpp index dace711..2fcfb37 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 } /* an item must be removed by an actor */ - if (actor == NULL) + if (actor == NULL) { Q_ASSERT(false); + } oldItem->onDie(actor); /* register item for removal in next update */ @@ -132,9 +133,11 @@ void SceneHolder::updateMap(const Transmission::map_t& map, const unsigned int x m_actors[color] = actor; addItem(actor); actor->setPos(mapPositionToCoord(x, y)); + qDebug() << endl << "create act " << endl; } else { + qDebug() << endl << "act has pnts: " << actor->getRoundPoints() << actor->getGamePoints() << endl; Actor::Movement direction = Util::transmissionMovementToActor( cur & Transmission::direction_mask); /* WARNING: do NOT add actor to visualMap as visualMap-items may @@ -151,6 +154,7 @@ void SceneHolder::updateMap(const Transmission::map_t& map, const unsigned int x qDebug() << "[SceneUpdate] actor moves: color=" << color << "direction=" << direction << "newpos=" << QPoint(x, y); } + actor->setPos(mapPositionToCoord(x, y)); } if (cur & Transmission::empty) @@ -195,6 +199,9 @@ unsigned int SceneHolder::pointsLeft() void SceneHolder::decrementPoints() { --m_pointsLeft; + if (m_pointsLeft == 0) { + emit allPointsRemoved(); + } } void SceneHolder::setEatingOrder(QList &order) -- cgit v1.2.3