fix(core): Fixes type caching & cleanup (#422)
- [X] Fixes some issues with the type caching - [X] Changes type check default to ignore case - [X] Splits out type caching of insensitive and sensitive lists. This means less stuff to iterate through when checking a type against the string. - [X] Adds an ArrayEnumerator, mostly for reference purposes (copy/paste as needed)
This commit is contained in:
parent
b921c38879
commit
e869c105d0
35 changed files with 253 additions and 96 deletions
|
|
@ -805,9 +805,9 @@ namespace Server
|
|||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public Skill Throwing => this[SkillName.Throwing];
|
||||
|
||||
public Enumerator GetEnumerator() => new(this);
|
||||
IEnumerator<Skill> IEnumerable<Skill>.GetEnumerator() => new Enumerator(this);
|
||||
IEnumerator IEnumerable.GetEnumerator() => new Enumerator(this);
|
||||
public Enumerator GetEnumerator() => new(m_Skills);
|
||||
IEnumerator<Skill> IEnumerable<Skill>.GetEnumerator() => GetEnumerator();
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
|
||||
public override string ToString() => "...";
|
||||
|
||||
|
|
@ -898,11 +898,11 @@ namespace Server
|
|||
|
||||
public struct Enumerator : IEnumerator<Skill>
|
||||
{
|
||||
private readonly Skills _skills;
|
||||
private readonly Skill[] _skills;
|
||||
private int _index;
|
||||
private Skill _current;
|
||||
|
||||
internal Enumerator(Skills skills)
|
||||
internal Enumerator(Skill[] skills)
|
||||
{
|
||||
_skills = skills;
|
||||
_index = 0;
|
||||
|
|
@ -915,11 +915,11 @@ namespace Server
|
|||
|
||||
public bool MoveNext()
|
||||
{
|
||||
Skills localList = _skills;
|
||||
Skill[] localList = _skills;
|
||||
|
||||
while ((uint)_index < (uint)localList.Length)
|
||||
{
|
||||
_current = localList.m_Skills[_index++];
|
||||
_current = _skills[_index++];
|
||||
if (_current != null)
|
||||
{
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue