summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-07-26 20:07:20 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-07-26 20:07:20 +0000
commit1c43b2cdee5a5508a6e771b477100517deae07e7 (patch)
tree5a5df16ea526daed5b8268f26d4e63c76017dec4 /src/net
parentea17e8e26173d641fc9b3710b65209c03af5aff3 (diff)
downloadmana-1c43b2cdee5a5508a6e771b477100517deae07e7.tar.gz
mana-1c43b2cdee5a5508a6e771b477100517deae07e7.tar.bz2
mana-1c43b2cdee5a5508a6e771b477100517deae07e7.tar.xz
mana-1c43b2cdee5a5508a6e771b477100517deae07e7.zip
Added Being::Type enumeration and type-aware findNode(). Fixed font not being reset after drawing speech. Target marker drawing moved into engine.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/protocol.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp
index 5a3fd487..8a8f0e6d 100644
--- a/src/net/protocol.cpp
+++ b/src/net/protocol.cpp
@@ -230,22 +230,30 @@ Being* attack(unsigned short x, unsigned short y, unsigned char direction)
{
Being *target = NULL;
- if (direction == SOUTH) {
- target = findNode(x, y + 1);
- } else if(direction == WEST) {
- target = findNode(x - 1, y);
- } else if(direction == NORTH) {
- target = findNode(x, y - 1);
- } else if(direction == EAST) {
- target = findNode(x + 1, y);
+ switch (direction)
+ {
+ case SOUTH:
+ target = findNode(x, y + 1, Being::MONSTER);
+ break;
+
+ case WEST:
+ target = findNode(x - 1, y, Being::MONSTER);
+ break;
+
+ case NORTH:
+ target = findNode(x, y - 1, Being::MONSTER);
+ break;
+
+ case EAST:
+ target = findNode(x + 1, y, Being::MONSTER);
+ break;
}
- if (target && target->isMonster()) {
+ if (target) {
attack(target);
- return target;
}
- return NULL;
+ return target;
}
void attack(Being *target)