From 85b09864f6d489e8c998e9f172d25079d572c602 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 18 Apr 2011 19:47:34 +0200 Subject: - add actor.canEat(other) to check if actor can eat other (note: that doesn't mean that other can eat actor!!) - server now generated and sends the colorlist to the server in the first map update packet - add a better AI --- pacman-c++/actor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pacman-c++/actor.cpp') 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() return (m_moving->state() == QAbstractAnimation::Running); } +bool Actor::canEat(Actor *other, const QList &order) +{ + if (other == NULL || order.empty() || m_color == other->color()) + return false; + + int idx = order.indexOf(m_color); + return (order.at(idx + 1) == other->color()); +} + void Actor::die() { if (!m_local) -- cgit v1.2.3