fix: Cleans up core code (#1187)
**Only one functional change** * Fixes a bug in LogFactory where `Warning` is being logged as `Information` Non-functional changes: * Updates/Fixes copyright headers * Removes namespace scopes for core files. View with [whitespace off](https://github.com/modernuo/ModernUO/pull/1187/files?w=1).
This commit is contained in:
parent
0138d40bda
commit
f268d5d4e2
262 changed files with 28527 additions and 28646 deletions
|
|
@ -1,84 +1,83 @@
|
|||
using System;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
public class Point3DList
|
||||
{
|
||||
public class Point3DList
|
||||
private static readonly Point3D[] m_EmptyList = Array.Empty<Point3D>();
|
||||
private Point3D[] m_List;
|
||||
|
||||
public Point3DList()
|
||||
{
|
||||
private static readonly Point3D[] m_EmptyList = Array.Empty<Point3D>();
|
||||
private Point3D[] m_List;
|
||||
m_List = new Point3D[8];
|
||||
Count = 0;
|
||||
}
|
||||
|
||||
public Point3DList()
|
||||
public int Count { get; private set; }
|
||||
|
||||
public Point3D Last => m_List[Count - 1];
|
||||
|
||||
public Point3D this[int index] => m_List[index];
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Count = 0;
|
||||
}
|
||||
|
||||
public void Add(int x, int y, int z)
|
||||
{
|
||||
if (Count + 1 > m_List.Length)
|
||||
{
|
||||
m_List = new Point3D[8];
|
||||
Count = 0;
|
||||
}
|
||||
var old = m_List;
|
||||
m_List = new Point3D[old.Length * 2];
|
||||
|
||||
public int Count { get; private set; }
|
||||
|
||||
public Point3D Last => m_List[Count - 1];
|
||||
|
||||
public Point3D this[int index] => m_List[index];
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Count = 0;
|
||||
}
|
||||
|
||||
public void Add(int x, int y, int z)
|
||||
{
|
||||
if (Count + 1 > m_List.Length)
|
||||
for (var i = 0; i < old.Length; ++i)
|
||||
{
|
||||
var old = m_List;
|
||||
m_List = new Point3D[old.Length * 2];
|
||||
|
||||
for (var i = 0; i < old.Length; ++i)
|
||||
{
|
||||
m_List[i] = old[i];
|
||||
}
|
||||
m_List[i] = old[i];
|
||||
}
|
||||
|
||||
m_List[Count].m_X = x;
|
||||
m_List[Count].m_Y = y;
|
||||
m_List[Count].m_Z = z;
|
||||
++Count;
|
||||
}
|
||||
|
||||
public void Add(Point3D p)
|
||||
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 (Count + 1 > m_List.Length)
|
||||
{
|
||||
if (Count + 1 > m_List.Length)
|
||||
var old = m_List;
|
||||
m_List = new Point3D[old.Length * 2];
|
||||
|
||||
for (var i = 0; i < old.Length; ++i)
|
||||
{
|
||||
var old = m_List;
|
||||
m_List = new Point3D[old.Length * 2];
|
||||
|
||||
for (var i = 0; i < old.Length; ++i)
|
||||
{
|
||||
m_List[i] = old[i];
|
||||
}
|
||||
m_List[i] = old[i];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public Point3D[] ToArray()
|
||||
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;
|
||||
}
|
||||
|
||||
public Point3D[] ToArray()
|
||||
{
|
||||
if (Count == 0)
|
||||
{
|
||||
if (Count == 0)
|
||||
{
|
||||
return m_EmptyList;
|
||||
}
|
||||
|
||||
var list = new Point3D[Count];
|
||||
|
||||
for (var i = 0; i < Count; ++i)
|
||||
{
|
||||
list[i] = m_List[i];
|
||||
}
|
||||
|
||||
Count = 0;
|
||||
|
||||
return list;
|
||||
return m_EmptyList;
|
||||
}
|
||||
|
||||
var list = new Point3D[Count];
|
||||
|
||||
for (var i = 0; i < Count; ++i)
|
||||
{
|
||||
list[i] = m_List[i];
|
||||
}
|
||||
|
||||
Count = 0;
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue