summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2012-07-14 14:45:23 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2012-07-14 18:54:32 +0200
commit66f1696f101c39f7e3f01641e562c0c5c8eac77f (patch)
treeecacbcfb68f7f14b29f9d75e848087de8541357a
parent17ad3131158024c2da32972eb8f21607b803994a (diff)
downloadmanaserv-66f1696f101c39f7e3f01641e562c0c5c8eac77f.tar.gz
manaserv-66f1696f101c39f7e3f01641e562c0c5c8eac77f.tar.xz
manaserv-66f1696f101c39f7e3f01641e562c0c5c8eac77f.zip
Fixed the get_beings_in_rectangle function.
Previously it only used the rectangle iterator which in fact iterated over the beings in the map zones and returned often way higher number of beings compared to the actual rectangle. Change is tested. Reviewed-by: Bjorn.
-rw-r--r--src/scripting/lua.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index b29ae74..ad4806c 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -1585,7 +1585,8 @@ static int get_beings_in_rectangle(lua_State *s)
{
Being *b = *i;
char t = b->getType();
- if (t == OBJECT_NPC || t == OBJECT_CHARACTER || t == OBJECT_MONSTER)
+ if ((t == OBJECT_NPC || t == OBJECT_CHARACTER || t == OBJECT_MONSTER) &&
+ rect.contains(b->getPosition()))
{
lua_pushlightuserdata(s, b);
lua_rawseti(s, tableStackPosition, tableIndex);