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

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
namespace Server.Commands.Generic
@ -47,20 +48,16 @@ namespace Server.Commands.Generic
if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
return;
IPooledEnumerable eable;
IPooledEnumerable<IEntity> eable;
if ( items && mobiles )
eable = map.GetObjectsInBounds( rect );
else if ( items )
eable = map.GetItemsInBounds( rect );
else if ( mobiles )
eable = map.GetMobilesInBounds( rect );
if (items || mobiles)
eable = map.GetObjectsInBounds(rect, items, mobiles);
else
return;
ArrayList objs = new ArrayList();
foreach ( object obj in eable )
foreach ( IEntity obj in eable )
{
if ( mobiles && obj is Mobile && !BaseCommand.IsAccessible( from, obj ) )
continue;
@ -81,4 +78,4 @@ namespace Server.Commands.Generic
}
}
}
}
}