private short[] GetRenderedBlock(int x, int y, bool statics)
{
TileMatrix matrix = this.Tiles;
if (x < 0 || y < 0 || x >= matrix.BlockWidth || y >= matrix.BlockHeight)
{
if (m_Black == null)
m_Black = new short[64];
return m_Black;
}
short[][][] cache;
if (Map.UseDiff)
cache = (statics ? m_Cache : m_Cache_NoStatics);
else
cache = (statics ? m_Cache_NoPatch : m_Cache_NoStatics_NoPatch);
if (cache == null)
{
if (Map.UseDiff)
{
if (statics)
m_Cache = cache = new short[m_Tiles.BlockHeight][][];
else
m_Cache_NoStatics = cache = new short[m_Tiles.BlockHeight][][];
}
else
{
if (statics)
m_Cache_NoPatch = cache = new short[m_Tiles.BlockHeight][][];
else
m_Cache_NoStatics_NoPatch = cache = new short[m_Tiles.BlockHeight][][];
}
}
if (cache[y] == null)
cache[y] = new short[m_Tiles.BlockWidth][];
short[] data = cache[y][x];
if (data == null)
cache[y][x] = data = RenderBlock(x, y, statics, Map.UseDiff);
return data;
}