Slight homoglyph search optimization

Instead of calling Find twice, it calls it once for the first character and checks if the returned group contains the other character
This commit is contained in:
juanjp600
2017-03-02 12:32:14 -03:00
parent ba026a8f88
commit ac3015f983
+2 -1
View File
@@ -1830,7 +1830,8 @@ namespace Barotrauma
for (int i=0;i<a.Length;i++)
{
if (a[i] == b[i]) continue;
if (homoglyphs.Find(g => g.Contains((uint)a[i])) != homoglyphs.Find(g => g.Contains((uint)b[i]))) return false;
uint[] glyphGroup = homoglyphs.Find(g => g.Contains((uint)a[i]));
if (glyphGroup==null || !glyphGroup.Contains((uint)b[i])) return false;
}
return true;
}