This commit is contained in:
parent
49b5e96850
commit
d903852b37
4 changed files with 21 additions and 16 deletions
|
|
@ -495,6 +495,15 @@ namespace Server
|
||||||
|
|
||||||
public delegate void Callback();
|
public delegate void Callback();
|
||||||
|
|
||||||
|
#if MONO
|
||||||
|
private static bool GenericComparator( Type type, object obj )
|
||||||
|
{
|
||||||
|
return ( type.IsGenericType )
|
||||||
|
&& ( type.GetGenericTypeDefinition() == typeof( IComparable<> ) )
|
||||||
|
&& ( type.GetGenericArguments()[0].IsAssignableFrom(obj as Type) );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public bool CompareTo( int sign, Callback argGenerator )
|
public bool CompareTo( int sign, Callback argGenerator )
|
||||||
{
|
{
|
||||||
Type active = this.Active;
|
Type active = this.Active;
|
||||||
|
|
@ -526,12 +535,16 @@ namespace Server
|
||||||
* Bleh.
|
* Bleh.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if MONO
|
||||||
|
Type[] ifaces = active.FindInterfaces( GenericComparator, active );
|
||||||
|
#else
|
||||||
Type[] ifaces = active.FindInterfaces( delegate( Type type, object obj )
|
Type[] ifaces = active.FindInterfaces( delegate( Type type, object obj )
|
||||||
{
|
{
|
||||||
return ( type.IsGenericType )
|
return ( type.IsGenericType )
|
||||||
&& ( type.GetGenericTypeDefinition() == typeof( IComparable<> ) )
|
&& ( type.GetGenericTypeDefinition() == typeof( IComparable<> ) )
|
||||||
&& ( type.GetGenericArguments()[0].IsAssignableFrom( active ) );
|
&& ( type.GetGenericArguments()[0].IsAssignableFrom( active ) );
|
||||||
}, null );
|
}, null );
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( ifaces.Length > 0 )
|
if ( ifaces.Length > 0 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -399,11 +399,8 @@ namespace Server
|
||||||
|
|
||||||
fixed ( StaticTile *pTiles = staTiles )
|
fixed ( StaticTile *pTiles = staTiles )
|
||||||
{
|
{
|
||||||
#if !MONO
|
|
||||||
NativeReader.Read( m_Statics.SafeFileHandle.DangerousGetHandle(), pTiles, length );
|
NativeReader.Read( m_Statics.SafeFileHandle.DangerousGetHandle(), pTiles, length );
|
||||||
#else
|
|
||||||
NativeReader.Read( m_Statics.Handle, pTiles, length );
|
|
||||||
#endif
|
|
||||||
if ( m_Lists == null )
|
if ( m_Lists == null )
|
||||||
{
|
{
|
||||||
m_Lists = new TileList[8][];
|
m_Lists = new TileList[8][];
|
||||||
|
|
@ -472,11 +469,7 @@ namespace Server
|
||||||
|
|
||||||
fixed ( Tile *pTiles = tiles )
|
fixed ( Tile *pTiles = tiles )
|
||||||
{
|
{
|
||||||
#if !MONO
|
|
||||||
NativeReader.Read( m_Map.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
|
NativeReader.Read( m_Map.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
|
||||||
#else
|
|
||||||
NativeReader.Read( m_Map.Handle, pTiles, 192 );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tiles;
|
return tiles;
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,7 @@ namespace Server
|
||||||
|
|
||||||
fixed ( Tile *pTiles = tiles )
|
fixed ( Tile *pTiles = tiles )
|
||||||
{
|
{
|
||||||
#if !MONO
|
|
||||||
NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
|
NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
|
||||||
#else
|
|
||||||
NativeReader.Read( fsData.Handle, pTiles, 192 );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix.SetLandBlock( x, y, tiles );
|
matrix.SetLandBlock( x, y, tiles );
|
||||||
|
|
@ -168,11 +164,7 @@ namespace Server
|
||||||
|
|
||||||
fixed ( StaticTile *pTiles = staTiles )
|
fixed ( StaticTile *pTiles = staTiles )
|
||||||
{
|
{
|
||||||
#if !MONO
|
|
||||||
NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length );
|
NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length );
|
||||||
#else
|
|
||||||
NativeReader.Read( fsData.Handle, pTiles, length );
|
|
||||||
#endif
|
|
||||||
StaticTile *pCur = pTiles, pEnd = pTiles + tileCount;
|
StaticTile *pCur = pTiles, pEnd = pTiles + tileCount;
|
||||||
|
|
||||||
while ( pCur < pEnd )
|
while ( pCur < pEnd )
|
||||||
|
|
|
||||||
|
|
@ -1247,10 +1247,17 @@ namespace Server
|
||||||
m.FacialHairHue = m.Race.RandomHairHue();
|
m.FacialHairHue = m.Race.RandomHairHue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MONO
|
||||||
|
public static List<TOutput> CastConvertList<TInput, TOutput>( List<TInput> list ) where TInput : class where TOutput : class
|
||||||
|
{
|
||||||
|
return list.ConvertAll<TOutput>( new Converter<TInput, TOutput>( delegate( TInput value ) { return value as TOutput; } ) );
|
||||||
|
}
|
||||||
|
#else
|
||||||
public static List<TOutput> CastConvertList<TInput, TOutput>( List<TInput> list ) where TOutput : TInput
|
public static List<TOutput> CastConvertList<TInput, TOutput>( List<TInput> list ) where TOutput : TInput
|
||||||
{
|
{
|
||||||
return list.ConvertAll<TOutput>( new Converter<TInput, TOutput>( delegate( TInput value ) { return (TOutput)value; } ) );
|
return list.ConvertAll<TOutput>( new Converter<TInput, TOutput>( delegate( TInput value ) { return (TOutput)value; } ) );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public static List<TOutput> SafeConvertList<TInput, TOutput>( List<TInput> list ) where TOutput : class
|
public static List<TOutput> SafeConvertList<TInput, TOutput>( List<TInput> list ) where TOutput : class
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue