Fixed brainfart, asserting that structure and wallsection rects have non-negative dimensions
This commit is contained in:
@@ -28,12 +28,16 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public WallSection(Rectangle rect)
|
public WallSection(Rectangle rect)
|
||||||
{
|
{
|
||||||
|
System.Diagnostics.Debug.Assert(rect.Width > 0 && rect.Height > 0);
|
||||||
|
|
||||||
this.rect = rect;
|
this.rect = rect;
|
||||||
damage = 0.0f;
|
damage = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WallSection(Rectangle rect, float damage)
|
public WallSection(Rectangle rect, float damage)
|
||||||
{
|
{
|
||||||
|
System.Diagnostics.Debug.Assert(rect.Width > 0 && rect.Height > 0);
|
||||||
|
|
||||||
this.rect = rect;
|
this.rect = rect;
|
||||||
this.damage = 0.0f;
|
this.damage = 0.0f;
|
||||||
}
|
}
|
||||||
@@ -207,6 +211,7 @@ namespace Barotrauma
|
|||||||
: base(sp, submarine)
|
: base(sp, submarine)
|
||||||
{
|
{
|
||||||
if (rectangle.Width == 0 || rectangle.Height == 0) return;
|
if (rectangle.Width == 0 || rectangle.Height == 0) return;
|
||||||
|
System.Diagnostics.Debug.Assert(rect.Width > 0 && rect.Height > 0);
|
||||||
|
|
||||||
rect = rectangle;
|
rect = rectangle;
|
||||||
prefab = sp;
|
prefab = sp;
|
||||||
@@ -317,7 +322,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ysections = (int)Math.Ceiling((float)rect.Height / wallSectionSize);
|
ysections = (int)Math.Ceiling((float)rect.Height / wallSectionSize);
|
||||||
sections = new WallSection[ysections];
|
sections = new WallSection[ysections];
|
||||||
width = rect.Width;
|
height = (int)wallSectionSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user