Changes properties to use automatic property initializers

This commit is contained in:
Kamron Batman 2018-09-14 15:23:29 -07:00
parent f0a48ad431
commit 06fa31a7bf
623 changed files with 13072 additions and 19304 deletions

View file

@ -23,28 +23,27 @@ namespace Server
public class Point3DList
{
private Point3D[] m_List;
private int m_Count;
public Point3DList()
{
m_List = new Point3D[8];
m_Count = 0;
Count = 0;
}
public int Count => m_Count;
public int Count { get; private set; }
public void Clear()
{
m_Count = 0;
Count = 0;
}
public Point3D Last => m_List[m_Count - 1];
public Point3D Last => m_List[Count - 1];
public Point3D this[int index] => m_List[index];
public void Add( int x, int y, int z )
{
if ( (m_Count + 1) > m_List.Length )
if ( (Count + 1) > m_List.Length )
{
Point3D[] old = m_List;
m_List = new Point3D[old.Length * 2];
@ -53,15 +52,15 @@ namespace Server
m_List[i] = old[i];
}
m_List[m_Count].m_X = x;
m_List[m_Count].m_Y = y;
m_List[m_Count].m_Z = z;
++m_Count;
m_List[Count].m_X = x;
m_List[Count].m_Y = y;
m_List[Count].m_Z = z;
++Count;
}
public void Add( Point3D p )
{
if ( (m_Count + 1) > m_List.Length )
if ( (Count + 1) > m_List.Length )
{
Point3D[] old = m_List;
m_List = new Point3D[old.Length * 2];
@ -70,25 +69,25 @@ namespace Server
m_List[i] = old[i];
}
m_List[m_Count].m_X = p.m_X;
m_List[m_Count].m_Y = p.m_Y;
m_List[m_Count].m_Z = p.m_Z;
++m_Count;
m_List[Count].m_X = p.m_X;
m_List[Count].m_Y = p.m_Y;
m_List[Count].m_Z = p.m_Z;
++Count;
}
private static Point3D[] m_EmptyList = new Point3D[0];
public Point3D[] ToArray()
{
if ( m_Count == 0 )
if ( Count == 0 )
return m_EmptyList;
Point3D[] list = new Point3D[m_Count];
Point3D[] list = new Point3D[Count];
for ( int i = 0; i < m_Count; ++i )
for ( int i = 0; i < Count; ++i )
list[i] = m_List[i];
m_Count = 0;
Count = 0;
return list;
}