summaryrefslogtreecommitdiffstats
path: root/pacman-c++/actor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pacman-c++/actor.cpp')
-rw-r--r--pacman-c++/actor.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp
index 9ff51f3..cf3fc13 100644
--- a/pacman-c++/actor.cpp
+++ b/pacman-c++/actor.cpp
@@ -193,6 +193,15 @@ bool Actor::isMoving()
193 return (m_moving->state() == QAbstractAnimation::Running); 193 return (m_moving->state() == QAbstractAnimation::Running);
194} 194}
195 195
196bool Actor::canEat(Actor *other, const QList<Color::Color> &order)
197{
198 if (other == NULL || order.empty() || m_color == other->color())
199 return false;
200
201 int idx = order.indexOf(m_color);
202 return (order.at(idx + 1) == other->color());
203}
204
196void Actor::die() 205void Actor::die()
197{ 206{
198 if (!m_local) 207 if (!m_local)