1
0
Fork 0

[server] Fix Rectangle Overlap() method

This commit is contained in:
Starbeamrainbowlabs 2017-05-04 21:35:27 +01:00
parent 19412e4361
commit 1b2d50b7af
1 changed files with 5 additions and 3 deletions

View File

@ -11,6 +11,8 @@ namespace SBRL.Utilities
/// <changelog>
/// v0.1 - 1st April 2017
/// - Added this changelog!
/// v0.2 - 4th May 2017
/// - Fixed Overlap(Rectangle otherRectangle) method
/// </changelog>
public struct Rectangle
{
@ -144,9 +146,9 @@ namespace SBRL.Utilities
/// <returns>Whether this rectangle overlaps another rectangle.</returns>
public bool Overlap(Rectangle otherRectangle)
{
if(Top > otherRectangle.Bottom &&
Bottom < otherRectangle.Top &&
Left > otherRectangle.Right &&
if(Top > otherRectangle.Bottom ||
Bottom < otherRectangle.Top ||
Left > otherRectangle.Right ||
Right < otherRectangle.Left)
return false;