a very interesting change
This commit is contained in:
parent
f9a35ca7bb
commit
ebbb3ab2af
3 changed files with 72 additions and 102 deletions
|
|
@ -42,11 +42,6 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
[DllImport( "Kernel32" )]
|
||||
private unsafe static extern int _lread( IntPtr hFile, void *lpBuffer, int wBytes );
|
||||
#endif
|
||||
|
||||
public int LandBlocks
|
||||
{
|
||||
get
|
||||
|
|
@ -104,27 +99,7 @@ namespace Server
|
|||
|
||||
fixed ( Tile *pTiles = tiles )
|
||||
{
|
||||
#if !MONO
|
||||
_lread( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
|
||||
#else
|
||||
if ( m_Buffer == null || 192 > m_Buffer.Length )
|
||||
m_Buffer = new byte[192];
|
||||
|
||||
fsData.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( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
|
||||
}
|
||||
|
||||
matrix.SetLandBlock( x, y, tiles );
|
||||
|
|
@ -137,10 +112,6 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
#if MONO
|
||||
private static byte[] m_Buffer;
|
||||
#endif
|
||||
|
||||
private static StaticTile[] m_TileBuffer = new StaticTile[128];
|
||||
|
||||
private unsafe int PatchStatics( TileMatrix matrix, string dataPath, string indexPath, string lookupPath )
|
||||
|
|
@ -193,27 +164,7 @@ namespace Server
|
|||
|
||||
fixed ( StaticTile *pTiles = staTiles )
|
||||
{
|
||||
#if !MONO
|
||||
_lread( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length );
|
||||
#else
|
||||
if ( m_Buffer == null || length > m_Buffer.Length )
|
||||
m_Buffer = new byte[length];
|
||||
|
||||
fsData.Read( m_Buffer, 0, length );
|
||||
|
||||
fixed ( byte *pbBuffer = m_Buffer )
|
||||
{
|
||||
StaticTile *pCopyBuffer = (StaticTile *)pbBuffer;
|
||||
StaticTile *pCopyEnd = pCopyBuffer + tileCount;
|
||||
StaticTile *pCopyCur = pTiles;
|
||||
|
||||
while ( pCopyBuffer < pCopyEnd ) {
|
||||
*pCopyCur = *pCopyBuffer;
|
||||
pCopyCur = pCopyCur + 1;
|
||||
pCopyBuffer = pCopyBuffer + 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length );
|
||||
|
||||
StaticTile *pCur = pTiles, pEnd = pTiles + tileCount;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue