Fixed hulls not being linked to gaps if the center of the gap is exactly at the edge of the adjacent hulls.
Closes #147
This commit is contained in:
@@ -491,10 +491,18 @@ namespace Barotrauma
|
||||
return new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y);
|
||||
}
|
||||
|
||||
public static bool RectContains(Rectangle rect, Vector2 pos)
|
||||
public static bool RectContains(Rectangle rect, Vector2 pos, bool inclusive = false)
|
||||
{
|
||||
return (pos.X > rect.X && pos.X < rect.X + rect.Width
|
||||
&& pos.Y < rect.Y && pos.Y > rect.Y - rect.Height);
|
||||
if (inclusive)
|
||||
{
|
||||
return (pos.X >= rect.X && pos.X <= rect.X + rect.Width
|
||||
&& pos.Y <= rect.Y && pos.Y >= rect.Y - rect.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (pos.X > rect.X && pos.X < rect.X + rect.Width
|
||||
&& pos.Y < rect.Y && pos.Y > rect.Y - rect.Height);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool RectsOverlap(Rectangle rect1, Rectangle rect2, bool inclusive=true)
|
||||
|
||||
Reference in New Issue
Block a user