diff options
author | Vladimir Menshakov | 2009-11-14 11:32:39 +0000 |
---|---|---|
committer | Vladimir Menshakov | 2009-11-14 11:32:39 +0000 |
commit | 772ac8ca709771fde478513addce3eec2eb4bbff (patch) | |
tree | 9d112c7ee89b4dad9a29a2def568913bc0e910e0 /engines/teenagent | |
parent | a6f954c365cc186bfd8770d088ffc3333c9224a8 (diff) | |
download | scummvm-rg350-772ac8ca709771fde478513addce3eec2eb4bbff.tar.gz scummvm-rg350-772ac8ca709771fde478513addce3eec2eb4bbff.tar.bz2 scummvm-rg350-772ac8ca709771fde478513addce3eec2eb4bbff.zip |
made rects signed
svn-id: r45891
Diffstat (limited to 'engines/teenagent')
-rw-r--r-- | engines/teenagent/objects.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/teenagent/objects.h b/engines/teenagent/objects.h index 5d7f3749e1..495ca773ac 100644 --- a/engines/teenagent/objects.h +++ b/engines/teenagent/objects.h @@ -32,7 +32,7 @@ namespace TeenAgent { struct Rect { - uint16 left, top, right, bottom; + int16 left, top, right, bottom; inline Rect() : left(0), top(0), right(0), bottom(0), _base(NULL) {} @@ -47,7 +47,7 @@ struct Rect { } inline bool valid() const { - return left < 320 && right < 320 && top < 200 && bottom < 200; + return left >= 0 && left < 320 && right >= 0 && right < 320 && top >= 0 && top < 200 && bottom >= 0 && bottom < 200; } void render(Graphics::Surface *surface, uint8 color) const; @@ -74,6 +74,10 @@ struct Rect { SWAP(y1, y2); return x >= left && x <= right && y1 <= bottom && y2 >= top; } + + inline bool contains(const Rect & rect) const { + return rect.left >= left && rect.right <= right && rect.top >= top && rect.bottom <= bottom; + } protected: byte * _base; |