Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -20,64 +20,63 @@
namespace Server
{
public class TileList
{
private StaticTile[] m_Tiles;
public class TileList
{
private static StaticTile[] m_EmptyTiles = new StaticTile[0];
private StaticTile[] m_Tiles;
public TileList()
{
m_Tiles = new StaticTile[8];
Count = 0;
}
public TileList()
{
m_Tiles = new StaticTile[8];
Count = 0;
}
public int Count { get; private set; }
public int Count{ get; private set; }
public void AddRange( StaticTile[] tiles )
{
if ( (Count + tiles.Length) > m_Tiles.Length )
{
StaticTile[] old = m_Tiles;
m_Tiles = new StaticTile[(Count + tiles.Length) * 2];
public void AddRange(StaticTile[] tiles)
{
if (Count + tiles.Length > m_Tiles.Length)
{
StaticTile[] old = m_Tiles;
m_Tiles = new StaticTile[(Count + tiles.Length) * 2];
for ( int i = 0; i < old.Length; ++i )
m_Tiles[i] = old[i];
}
for (int i = 0; i < old.Length; ++i)
m_Tiles[i] = old[i];
}
for ( int i = 0; i < tiles.Length; ++i )
m_Tiles[Count++] = tiles[i];
}
for (int i = 0; i < tiles.Length; ++i)
m_Tiles[Count++] = tiles[i];
}
public void Add( ushort id, sbyte z )
{
if ( (Count + 1) > m_Tiles.Length )
{
StaticTile[] old = m_Tiles;
m_Tiles = new StaticTile[old.Length * 2];
public void Add(ushort id, sbyte z)
{
if (Count + 1 > m_Tiles.Length)
{
StaticTile[] old = m_Tiles;
m_Tiles = new StaticTile[old.Length * 2];
for ( int i = 0; i < old.Length; ++i )
m_Tiles[i] = old[i];
}
for (int i = 0; i < old.Length; ++i)
m_Tiles[i] = old[i];
}
m_Tiles[Count].m_ID = id;
m_Tiles[Count].m_Z = z;
++Count;
}
m_Tiles[Count].m_ID = id;
m_Tiles[Count].m_Z = z;
++Count;
}
private static StaticTile[] m_EmptyTiles = new StaticTile[0];
public StaticTile[] ToArray()
{
if (Count == 0)
return m_EmptyTiles;
public StaticTile[] ToArray()
{
if ( Count == 0 )
return m_EmptyTiles;
StaticTile[] tiles = new StaticTile[Count];
StaticTile[] tiles = new StaticTile[Count];
for (int i = 0; i < Count; ++i)
tiles[i] = m_Tiles[i];
for ( int i = 0; i < Count; ++i )
tiles[i] = m_Tiles[i];
Count = 0;
Count = 0;
return tiles;
}
}
return tiles;
}
}
}