summaryrefslogtreecommitdiffstats
path: root/pacman-c++/actor.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-04-18 19:47:34 +0200
committermanuel <manuel@mausz.at>2011-04-18 19:47:34 +0200
commit85b09864f6d489e8c998e9f172d25079d572c602 (patch)
treea6e38da5dc828810b21045d0ac1e4babcf198825 /pacman-c++/actor.cpp
parente373442901064d07791c9739daa380acb1dfbb8c (diff)
downloadfoop-85b09864f6d489e8c998e9f172d25079d572c602.tar.gz
foop-85b09864f6d489e8c998e9f172d25079d572c602.tar.bz2
foop-85b09864f6d489e8c998e9f172d25079d572c602.zip
- 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
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)