diff --git a/Scripts/Misc/Emitter.cs b/Scripts/Misc/Emitter.cs index 69639a575..b5f83d07a 100644 --- a/Scripts/Misc/Emitter.cs +++ b/Scripts/Misc/Emitter.cs @@ -495,6 +495,15 @@ namespace Server 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 ) { Type active = this.Active; @@ -526,12 +535,16 @@ namespace Server * Bleh. */ +#if MONO + Type[] ifaces = active.FindInterfaces( GenericComparator, active ); +#else Type[] ifaces = active.FindInterfaces( delegate( Type type, object obj ) { return ( type.IsGenericType ) && ( type.GetGenericTypeDefinition() == typeof( IComparable<> ) ) && ( type.GetGenericArguments()[0].IsAssignableFrom( active ) ); }, null ); +#endif if ( ifaces.Length > 0 ) { diff --git a/Server/TileMatrix.cs b/Server/TileMatrix.cs index 0e81c17df..291182feb 100644 --- a/Server/TileMatrix.cs +++ b/Server/TileMatrix.cs @@ -399,11 +399,8 @@ namespace Server fixed ( StaticTile *pTiles = staTiles ) { -#if !MONO NativeReader.Read( m_Statics.SafeFileHandle.DangerousGetHandle(), pTiles, length ); -#else - NativeReader.Read( m_Statics.Handle, pTiles, length ); -#endif + if ( m_Lists == null ) { m_Lists = new TileList[8][]; @@ -472,11 +469,7 @@ namespace Server fixed ( Tile *pTiles = tiles ) { -#if !MONO NativeReader.Read( m_Map.SafeFileHandle.DangerousGetHandle(), pTiles, 192 ); -#else - NativeReader.Read( m_Map.Handle, pTiles, 192 ); -#endif } return tiles; diff --git a/Server/TileMatrixPatch.cs b/Server/TileMatrixPatch.cs index 84e44e6b0..ea4b45cf1 100644 --- a/Server/TileMatrixPatch.cs +++ b/Server/TileMatrixPatch.cs @@ -99,11 +99,7 @@ namespace Server fixed ( Tile *pTiles = tiles ) { -#if !MONO NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192 ); -#else - NativeReader.Read( fsData.Handle, pTiles, 192 ); -#endif } matrix.SetLandBlock( x, y, tiles ); @@ -168,11 +164,7 @@ namespace Server fixed ( StaticTile *pTiles = staTiles ) { -#if !MONO NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length ); -#else - NativeReader.Read( fsData.Handle, pTiles, length ); -#endif StaticTile *pCur = pTiles, pEnd = pTiles + tileCount; while ( pCur < pEnd ) diff --git a/Server/Utility.cs b/Server/Utility.cs index 398491213..ff4126501 100644 --- a/Server/Utility.cs +++ b/Server/Utility.cs @@ -1247,10 +1247,17 @@ namespace Server m.FacialHairHue = m.Race.RandomHairHue(); } +#if MONO + public static List CastConvertList( List list ) where TInput : class where TOutput : class + { + return list.ConvertAll( new Converter( delegate( TInput value ) { return value as TOutput; } ) ); + } +#else public static List CastConvertList( List list ) where TOutput : TInput { return list.ConvertAll( new Converter( delegate( TInput value ) { return (TOutput)value; } ) ); } +#endif public static List SafeConvertList( List list ) where TOutput : class {