From 66f1696f101c39f7e3f01641e562c0c5c8eac77f 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(-) 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); -- cgit