fix(core): Removes some uses of Linq (#421)
- [X] Removes some uses of linq - [X] Creates struct based enumerator for Skills - [X] Creates a struct based enumerator for TypeCache - [X] Changes HarvestDefinition to an init array instead of List - [X] Changes HeritageTokenGump Response from List to Array
This commit is contained in:
parent
52356866ed
commit
b921c38879
50 changed files with 1006 additions and 507 deletions
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Accounting;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Engines.ConPVP;
|
||||
|
|
@ -275,18 +274,37 @@ namespace Server.Factions
|
|||
}
|
||||
|
||||
var eable = mob.Map.GetObjectsInRange(mob.Location, range, items, mobs);
|
||||
var isInstance = eable.Any(type.IsInstanceOfType);
|
||||
foreach (var obj in eable)
|
||||
{
|
||||
if (type.IsInstanceOfType(obj))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
||||
return isInstance;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsNearType(Mobile mob, Type[] types, int range)
|
||||
{
|
||||
var eable = mob.GetObjectsInRange(range);
|
||||
var found = eable.Any(obj => types.Any(t => t.IsInstanceOfType(obj)));
|
||||
foreach (var obj in eable)
|
||||
{
|
||||
for (int i = 0; i < types.Length; i++)
|
||||
{
|
||||
if (types[i].IsInstanceOfType(obj))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
return found;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RemovePlayerState(PlayerState pl)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue