milt
Knight
Shortening of code
Was bored looking through some RunUO core code the other night and noticed the following inside of Poin3DList.cs:
Wouldn't it have been much simpler to have just put the following for the second overload? (Point3D)
I know that it is not a bug and it works fine, but just decided to post this in case you wanted to shorten the code a bit.
Was bored looking through some RunUO core code the other night and noticed the following inside of Poin3DList.cs:
Code:
public void Add( int x, int y, int z )
{
if ( (m_Count + 1) > m_List.Length )
{
Point3D[] old = m_List;
m_List = new Point3D[old.Length * 2];
for ( int i = 0; i < old.Length; ++i )
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;
}
public void Add( Point3D p )
{
if ( (m_Count + 1) > m_List.Length )
{
Point3D[] old = m_List;
m_List = new Point3D[old.Length * 2];
for ( int i = 0; i < old.Length; ++i )
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;
}
Code:
public void Add( Point3D p )
{
Add( p.X, p.Y, p.Z );
}