summaryrefslogtreecommitdiff
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:12 +0200
commit83b30bfb41aa11cbe3fc2b3dff56192c93ecf040 (patch)
treec34942a47d46a131203ee353411afe53a3a5f37d
parent907b740c17a69a487126c63f6ff917d494a25a1f (diff)
downloadmanaserv-83b30bfb41aa11cbe3fc2b3dff56192c93ecf040.tar.gz
manaserv-83b30bfb41aa11cbe3fc2b3dff56192c93ecf040.tar.bz2
manaserv-83b30bfb41aa11cbe3fc2b3dff56192c93ecf040.tar.xz
manaserv-83b30bfb41aa11cbe3fc2b3dff56192c93ecf040.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 a07b287c..4c849180 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -1583,7 +1583,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);