From 83b30bfb41aa11cbe3fc2b3dff56192c93ecf040 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Sat, 14 Jul 2012 14:45:23 +0200 Subject: 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. --- src/scripting/lua.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/scripting/lua.cpp') 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); -- cgit v1.2.3-70-g09d2