a very interesting change

This commit is contained in:
mark 2007-09-14 07:44:17 +00:00
parent f9a35ca7bb
commit ebbb3ab2af
3 changed files with 72 additions and 102 deletions

View file

@ -50,11 +50,6 @@ namespace Server
private int[][] m_StaticPatches;
private int[][] m_LandPatches;
#if !MONO
[DllImport( "Kernel32" )]
private unsafe static extern int _lread( IntPtr hFile, void *lpBuffer, int wBytes );
#endif
public Map Owner
{
get
@ -376,10 +371,6 @@ namespace Server
private static TileList[][] m_Lists;
#if MONO
private static byte[] m_Buffer;
#endif
private static StaticTile[] m_TileBuffer = new StaticTile[128];
private unsafe Tile[][][] ReadStaticBlock( int x, int y )
@ -408,27 +399,7 @@ namespace Server
fixed ( StaticTile *pTiles = staTiles )
{
#if !MONO
_lread( m_Statics.SafeFileHandle.DangerousGetHandle(), pTiles, length );
#else
if ( m_Buffer == null || length > m_Buffer.Length )
m_Buffer = new byte[length];
m_Statics.Read( m_Buffer, 0, length );
fixed ( byte *pbBuffer = m_Buffer )
{
StaticTile *pCopyBuffer = (StaticTile *)pbBuffer;
StaticTile *pCopyEnd = pCopyBuffer + count;
StaticTile *pCopyCur = pTiles;
while ( pCopyBuffer < pCopyEnd ) {
*pCopyCur = *pCopyBuffer;
pCopyCur = pCopyCur + 1;
pCopyBuffer = pCopyBuffer + 1;
}
}
#endif
NativeReader.Read( m_Statics.SafeFileHandle.DangerousGetHandle(), pTiles, length );
if ( m_Lists == null )
{
@ -498,27 +469,7 @@ namespace Server
fixed ( Tile *pTiles = tiles )
{
#if !MONO
_lread( m_Map.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
#else
if ( m_Buffer == null || 192 > m_Buffer.Length )
m_Buffer = new byte[192];
m_Map.Read( m_Buffer, 0, 192 );
fixed ( byte *pbBuffer = m_Buffer )
{
Tile *pBuffer = (Tile *)pbBuffer;
Tile *pEnd = pBuffer + 64;
Tile *pCur = pTiles;
while ( pBuffer < pEnd ) {
*pCur = *pBuffer;
pCur = pCur + 1;
pBuffer = pBuffer + 1;
}
}
#endif
NativeReader.Read( m_Map.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
}
return tiles;