From ea2880702a7df079f5e8eee0280584f186c2de73 Mon Sep 17 00:00:00 2001 From: totycro Date: Mon, 11 Apr 2011 13:03:40 +0200 Subject: Added code to play the cherry sound, but doesn't work here --- pacman-c++/sceneholder.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'pacman-c++/sceneholder.cpp') diff --git a/pacman-c++/sceneholder.cpp b/pacman-c++/sceneholder.cpp index e4429f6..c819b95 100644 --- a/pacman-c++/sceneholder.cpp +++ b/pacman-c++/sceneholder.cpp @@ -40,8 +40,16 @@ void SceneHolder::updateMap(const Transmission::map_t& map) { m_scene->removeItem(oldItem); visualMap[x][y] = NULL; + Actor *actor = NULL; + foreach (Actor *i, m_actors) { + if (CoordToMapPosition(i->pos().x(), i->pos().y()) == QPoint(x, y)) { + actor = i; + break; + } + } + oldItem->onDie(actor); delete oldItem; - qDebug() << "deleting " << x << y; + //qDebug() << "deleting " << x << y; } } @@ -104,7 +112,6 @@ void SceneHolder::updateMap(const Transmission::map_t& map) visualMap[x][y] = item; if (oldItem != NULL) { - oldItem->onDie(); m_scene->removeItem(item); delete oldItem; } -- cgit v1.2.3