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

@ -252,7 +252,7 @@ namespace Server.Spells.Fifth
if ( map != null && caster != null )
{
bool eastToWest = ( m_Item.ItemID == 0x3915 );
IPooledEnumerable eable = map.GetMobilesInBounds( new Rectangle2D( m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1) ) );
IPooledEnumerable<Mobile> eable = map.GetMobilesInBounds( new Rectangle2D( m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1) ) );
foreach ( Mobile m in eable )
{
@ -298,4 +298,4 @@ namespace Server.Spells.Fifth
}
}
}
}
}

View file

@ -57,7 +57,7 @@ namespace Server.Spells.Fourth
if ( directTarget != null && Caster.CanBeBeneficial( directTarget, false ) )
targets.Add( directTarget );
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 2 );
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange( new Point3D( p ), 2 );
foreach ( Mobile m in eable )
{
@ -187,4 +187,4 @@ namespace Server.Spells.Fourth
}
}
}
}
}

View file

@ -48,7 +48,7 @@ namespace Server.Spells.Fourth
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), Core.AOS ? 2 : 3 );
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange( new Point3D( p ), Core.AOS ? 2 : 3 );
foreach ( Mobile m in eable )
{

View file

@ -53,7 +53,7 @@ namespace Server.Spells.Seventh
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 2 );
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange( new Point3D( p ), 2 );
foreach ( Mobile m in eable )
{
@ -140,4 +140,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -66,7 +66,7 @@ namespace Server.Spells.Seventh
{
bool _gateFound = false;
IPooledEnumerable eable = map.GetItemsInRange( loc, 0 );
IPooledEnumerable<Item> eable = map.GetItemsInRange( loc, 0 );
foreach ( Item item in eable )
{
if ( item is Moongate || item is PublicMoongate )
@ -255,4 +255,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -49,10 +49,10 @@ namespace Server.Spells.Seventh
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 8 );
IPooledEnumerable<BaseCreature> eable = map.GetMobilesInRange<BaseCreature>( new Point3D( p ), 8 );
foreach ( Mobile m in eable )
if ( m is BaseCreature && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful( m, false ) )
foreach ( BaseCreature m in eable )
if ( m.IsDispellable && Caster.CanBeHarmful( m, false ) )
targets.Add( m );
eable.Free();
@ -111,4 +111,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -53,7 +53,7 @@ namespace Server.Spells.Seventh
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 2 );
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange( new Point3D( p ), 2 );
foreach ( Mobile m in eable )
{
@ -136,4 +136,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -49,7 +49,7 @@ namespace Server.Spells.Sixth
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 2 );
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange( new Point3D( p ), 2 );
foreach ( Mobile m in eable )
{
@ -106,4 +106,4 @@ namespace Server.Spells.Sixth
}
}
}
}
}

View file

@ -46,7 +46,7 @@ namespace Server.Spells.Sixth
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 1 + (int)(Caster.Skills[SkillName.Magery].Value / 20.0) );
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange( new Point3D( p ), 1 + (int)(Caster.Skills[SkillName.Magery].Value / 20.0) );
foreach ( Mobile m in eable )
{
@ -120,4 +120,4 @@ namespace Server.Spells.Sixth
}
}
}
}
}

View file

@ -86,7 +86,7 @@ namespace Server.Spells.Spellweaving
return true;
}
IPooledEnumerable eable = map.GetItemsInRange( location, 0 ); // Added Tiles
IPooledEnumerable<Item> eable = map.GetItemsInRange( location, 0 ); // Added Tiles
foreach( Item item in eable )
{
@ -162,4 +162,4 @@ namespace Server.Spells.Spellweaving
}
}
}
}
}

View file

@ -100,7 +100,7 @@ namespace Server.Spells.Third
m.PlaySound( 0x1FE );
IPooledEnumerable eable = m.GetItemsInRange( 0 );
IPooledEnumerable<Item> eable = m.GetItemsInRange( 0 );
foreach ( Item item in eable )
{
@ -137,4 +137,4 @@ namespace Server.Spells.Third
}
}
}
}
}