diff options
Diffstat (limited to 'pacman-c++/sceneholder.cpp')
| -rw-r--r-- | pacman-c++/sceneholder.cpp | 11 |
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() | |||
| 195 | void SceneHolder::decrementPoints() | 201 | void SceneHolder::decrementPoints() |
| 196 | { | 202 | { |
| 197 | --m_pointsLeft; | 203 | --m_pointsLeft; |
| 204 | if (m_pointsLeft == 0) { | ||
| 205 | emit allPointsRemoved(); | ||
| 206 | } | ||
| 198 | } | 207 | } |
| 199 | 208 | ||
| 200 | void SceneHolder::setEatingOrder(QList<Color::Color> &order) | 209 | void SceneHolder::setEatingOrder(QList<Color::Color> &order) |
