From c3b3d57b57ae8fcf9527f3595cd9809059cbea12 Mon Sep 17 00:00:00 2001 From: Regalis Date: Thu, 3 Nov 2016 19:09:14 +0200 Subject: [PATCH] Fixed brainfart, asserting that structure and wallsection rects have non-negative dimensions --- Subsurface/Source/Map/Structure.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Subsurface/Source/Map/Structure.cs b/Subsurface/Source/Map/Structure.cs index bbdba3e63..2f2197737 100644 --- a/Subsurface/Source/Map/Structure.cs +++ b/Subsurface/Source/Map/Structure.cs @@ -28,12 +28,16 @@ namespace Barotrauma public WallSection(Rectangle rect) { + System.Diagnostics.Debug.Assert(rect.Width > 0 && rect.Height > 0); + this.rect = rect; damage = 0.0f; } public WallSection(Rectangle rect, float damage) { + System.Diagnostics.Debug.Assert(rect.Width > 0 && rect.Height > 0); + this.rect = rect; this.damage = 0.0f; } @@ -207,6 +211,7 @@ namespace Barotrauma : base(sp, submarine) { if (rectangle.Width == 0 || rectangle.Height == 0) return; + System.Diagnostics.Debug.Assert(rect.Width > 0 && rect.Height > 0); rect = rectangle; prefab = sp; @@ -317,7 +322,7 @@ namespace Barotrauma { ysections = (int)Math.Ceiling((float)rect.Height / wallSectionSize); sections = new WallSection[ysections]; - width = rect.Width; + height = (int)wallSectionSize; } }