summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-26 00:01:29 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-09-28 16:05:21 +0200
commit0228543e6602177d933f6c88de56601201a8ab76 (patch)
tree6870420a84279ba867f3972409d9343c608193e3 /src
parent04fb1b30a04b6d90abc1561c2d11c2371a29bc98 (diff)
downloadmanaserv-0228543e6602177d933f6c88de56601201a8ab76.tar.gz
manaserv-0228543e6602177d933f6c88de56601201a8ab76.tar.bz2
manaserv-0228543e6602177d933f6c88de56601201a8ab76.tar.xz
manaserv-0228543e6602177d933f6c88de56601201a8ab76.zip
Fixed the trigger area declared within map files.
The bug was pretty generic, as the contains() method of the Rectangle class wasn't checking against left and top sides according to the client view point. I also documented the call site. Resolves: Mana-Mantis #317. Reviewed-by: o11c.
Diffstat (limited to 'src')
-rw-r--r--src/game-server/trigger.cpp6
-rw-r--r--src/utils/point.h4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/game-server/trigger.cpp b/src/game-server/trigger.cpp
index f25b00b8..19ca3512 100644
--- a/src/game-server/trigger.cpp
+++ b/src/game-server/trigger.cpp
@@ -55,7 +55,11 @@ void TriggerArea::update()
//skip garbage
if (!(*i) || (*i)->getPublicID() == 0) continue;
- if (mZone.contains((*i)->getPosition())) //<-- Why is this additional condition necessary? Shouldn't getInsideRectangleIterator already exclude those outside of the zone? --Crush
+ // The BeingIterator returns the mapZones in touch with the rectangle
+ // area. On the other hand, the beings contained in the map zones
+ // may not be within the rectangle area. Hence, this additional
+ // contains() condition.
+ if (mZone.contains((*i)->getPosition()))
{
insideNow.insert(*i);
diff --git a/src/utils/point.h b/src/utils/point.h
index 4402aa09..988b6c5a 100644
--- a/src/utils/point.h
+++ b/src/utils/point.h
@@ -75,8 +75,8 @@ class Rectangle
bool contains(const Point &p) const
{
- return (p.x - x) < w &&
- (p.y - y) < h;
+ return (p.x >= x && p.x < x + w &&
+ p.y >= y && p.y < y + h);
}
bool intersects(const Rectangle &r) const