From a246c08cef5e4d598fc07a681eb971bfbcf01519 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Fri, 7 Oct 2005 00:12:32 +0000 Subject: Modified finding NPC as by timonator's suggestion in order to allow NPCs to be clicked on their heads too. Also made start to tile engine improvement by adding the Sprite class that is now used by the floor items for being displayed on the map. Finally added documentation to Item class and splitted out Properties class from Map. --- src/being.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/being.cpp') diff --git a/src/being.cpp b/src/being.cpp index 4301b0a9..5cdd8c01 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -118,7 +118,11 @@ Being *findNode(Uint16 x, Uint16 y) for (i = beings.begin(); i != beings.end(); i++) { Being *being = (*i); // Return being if found and it is not a dead monster - if (being->x == x && being->y == y && being->action != Being::MONSTER_DEAD) { + if (being->x == x && + (being->y == y || + (being->getType() == Being::NPC && being->y == y + 1)) && + being->action != Being::MONSTER_DEAD) + { return being; } } @@ -131,8 +135,11 @@ Being* findNode(Uint16 x, Uint16 y, Being::Type type) for (i = beings.begin(); i != beings.end(); i++) { Being *being = (*i); // Check if is a NPC (only low job ids) - if (being->x == x && being->y == y && - being->getType() == type && being->action != Being::MONSTER_DEAD) + if (being->x == x && + (being->y == y || + (being->getType() == Being::NPC && being->y == y + 1)) && + being->getType() == type && + being->action != Being::MONSTER_DEAD) { return being; } -- cgit v1.2.3-70-g09d2