2010-09-17 17:12:08 +00:00
|
|
|
|
#region === Copyright (c) 2010 Pascal van der Heiden ===
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
2010-09-17 17:12:08 +00:00
|
|
|
|
{
|
|
|
|
|
internal class SectorLevelComparer : IComparer<SectorLevel>
|
|
|
|
|
{
|
|
|
|
|
// Center of sector to use for plane comparison
|
|
|
|
|
public Vector2D center;
|
|
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
|
public SectorLevelComparer(Sector s)
|
|
|
|
|
{
|
|
|
|
|
this.center = new Vector2D(s.BBox.Left + s.BBox.Width / 2, s.BBox.Top + s.BBox.Height / 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Comparer
|
|
|
|
|
public int Compare(SectorLevel x, SectorLevel y)
|
|
|
|
|
{
|
2015-02-12 22:04:49 +00:00
|
|
|
|
return (x == y ? 0 : Math.Sign(x.plane.GetZ(center) - y.plane.GetZ(center))); //mxd. Added equality check
|
2010-09-17 17:12:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|