Adds better type support for pooled enumerables. Refactors code. (#16)

This commit is contained in:
Kamron Batman 2018-08-09 14:08:34 -07:00 committed by GitHub
parent 62b95f4d74
commit b06f5bf60d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 252 additions and 243 deletions

View file

@ -144,15 +144,12 @@ namespace Server
xTotal += fp.X;
yTotal += fp.Y;
IPooledEnumerable eable = map.GetItemsInRange( new Point3D( fp.X, fp.Y, 0 ), 0 );
IPooledEnumerable<Spawner> eable = map.GetItemsInRange<Spawner>( new Point3D( fp.X, fp.Y, 0 ), 0 );
foreach ( Item item in eable )
foreach ( Spawner item in eable )
{
if ( item is Spawner )
{
hasSpawner = true;
break;
}
hasSpawner = true;
break;
}
eable.Free();
@ -529,4 +526,4 @@ namespace Server
}
}
}
}
}

View file

@ -1,5 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Server.Mobiles;
using Server.Items;
@ -40,7 +40,6 @@ namespace Server
if ( File.Exists( vendor_path ) )
{
ArrayList list = new ArrayList();
from.SendMessage( "Generating Vendors..." );
using ( StreamReader ip = new StreamReader( vendor_path ) )
@ -295,15 +294,14 @@ namespace Server
return z;
}
private static Queue m_ToDelete = new Queue();
public static void ClearSpawners( int x, int y, int z, Map map )
{
IPooledEnumerable eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 );
IPooledEnumerable<Spawner> eable = map.GetItemsInRange<Spawner>( new Point3D( x, y, z ), 0 );
Queue<Spawner> m_ToDelete = new Queue<Spawner>();
foreach ( Item item in eable )
foreach ( Spawner item in eable )
{
if ( item is Spawner && item.Z == z )
if ( item.Z == z )
m_ToDelete.Enqueue( item );
}