Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
{
|
||||
|
|
@ -36,28 +37,15 @@ namespace Server.Commands.Generic
|
|||
if (!CheckObjectTypes(from, command, ext, out bool items, out bool mobiles))
|
||||
return;
|
||||
|
||||
IPooledEnumerable<IEntity> eable;
|
||||
|
||||
if (items || mobiles)
|
||||
eable = map.GetObjectsInBounds(rect, items, mobiles);
|
||||
else
|
||||
if (!(items || mobiles))
|
||||
return;
|
||||
|
||||
eable.Free();
|
||||
IPooledEnumerable<IEntity> eable = map.GetObjectsInBounds(rect, items, mobiles);
|
||||
|
||||
List<object> objs = new List<object>();
|
||||
|
||||
foreach (IEntity obj in eable)
|
||||
{
|
||||
if (mobiles && obj is Mobile && !BaseCommand.IsAccessible(from, obj))
|
||||
continue;
|
||||
|
||||
if (ext.IsValid(obj))
|
||||
objs.Add(obj);
|
||||
}
|
||||
List<object> objs = eable.Where(obj => !mobiles || !(obj is Mobile) || BaseCommand.IsAccessible(from, obj))
|
||||
.Where(obj => ext.IsValid(obj)).Cast<object>().ToList();
|
||||
|
||||
eable.Free();
|
||||
|
||||
ext.Filter(objs);
|
||||
|
||||
RunCommand(from, objs, command, args);
|
||||
|
|
@ -68,4 +56,4 @@ namespace Server.Commands.Generic
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue