diff options
author | Vladimir Menshakov | 2009-11-12 13:29:09 +0000 |
---|---|---|
committer | Vladimir Menshakov | 2009-11-12 13:29:09 +0000 |
commit | 3d796d6c088677ab30f1aae0226651f46d46013f (patch) | |
tree | 5e5a8804d1abc949ff8e0eb9814465d2125bbb48 /engines | |
parent | 1351703dc0f911cb94d73275371007132295bbdd (diff) | |
download | scummvm-rg350-3d796d6c088677ab30f1aae0226651f46d46013f.tar.gz scummvm-rg350-3d796d6c088677ab30f1aae0226651f46d46013f.tar.bz2 scummvm-rg350-3d796d6c088677ab30f1aae0226651f46d46013f.zip |
fixed intersects functions
svn-id: r45861
Diffstat (limited to 'engines')
-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 1cba0391cf..5d7f3749e1 100644 --- a/engines/teenagent/objects.h +++ b/engines/teenagent/objects.h @@ -64,11 +64,15 @@ struct Rect { void save() const; inline bool intersects_hline(int x1, int x2, int y) const { - return x1 < right && x2 > left && y >= top && y < bottom; + if (x1 > x2) + SWAP(x1, x2); + return y >= top && y <= bottom && x1 <= right && x2 >= left; } inline bool intersects_vline(int x, int y1, int y2) const { - return y1 < bottom && y2 > top && x >= left && x < right; + if (y1 > y2) + SWAP(y1, y2); + return x >= left && x <= right && y1 <= bottom && y2 >= top; } protected: |