UltimateZoneBuilder/Source/Plugins/BuilderModes/ErrorChecks/ResultMapTooBig.cs
MaxED ecb650259b Added "safeboundary" game configuration property. The value determines the maximum map bounding box size considered to be safe by "Check map size" error check.
Changed, Map Analysis mode: some checks are now available only under certain conditions (for example, "Check polyobjects" is now available only when the map is in Hexen or UDMF map format).
Updated documentation ("Game Configuration - Basic Settings" page).
2016-05-18 23:31:12 +00:00

65 lines
1.8 KiB
C#

#region ================== Namespaces
using System.Drawing;
using CodeImp.DoomBuilder.Geometry;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes.ErrorChecks
{
public class ResultMapTooBig : ErrorResult
{
#region ================== Variables
private readonly bool toowide;
private readonly bool toohigh;
private readonly Vector2D min;
private readonly Vector2D max;
#endregion
#region ================== Properties
public override int Buttons { get { return 0; } }
#endregion
#region ================== Constructor / Destructor
public ResultMapTooBig(Vector2D min, Vector2D max)
{
// Initialize
this.min = min;
this.max = max;
this.toowide = max.x - min.x > General.Map.Config.SafeBoundary;
this.toohigh = max.y - min.y > General.Map.Config.SafeBoundary;
description = "Map is too big.";
}
#endregion
#region ================== Methods
public override RectangleF GetZoomArea()
{
const float scaler = 0.5f;
return new RectangleF(min.x * scaler, min.y * scaler, (max.x - min.x) * scaler, (max.y - min.y) * scaler);
}
// This sets if this result is displayed in ErrorCheckForm (mxd)
internal override void Hide(bool hide)
{
hidden = hide;
}
// This must return the string that is displayed in the listbox
public override string ToString()
{
if(toowide && toohigh) return "Map's width and height is bigger than " + General.Map.Config.SafeBoundary + " m.u. This can cause rendering and physics issues.";
if(toowide) return "Map is wider than " + General.Map.Config.SafeBoundary + " m.u. This can cause rendering and physics issues.";
return "Map is taller than " + General.Map.Config.SafeBoundary + " m.u. This can cause rendering and physics issues.";
}
#endregion
}
}