From ac3015f983f81a60931996948e25ab78daf62566 Mon Sep 17 00:00:00 2001 From: juanjp600 Date: Thu, 2 Mar 2017 12:32:14 -0300 Subject: [PATCH] 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 --- Subsurface/Source/Utils/Homoglyphs.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Subsurface/Source/Utils/Homoglyphs.cs b/Subsurface/Source/Utils/Homoglyphs.cs index 53b0f0bcf..248129fd0 100644 --- a/Subsurface/Source/Utils/Homoglyphs.cs +++ b/Subsurface/Source/Utils/Homoglyphs.cs @@ -1830,7 +1830,8 @@ namespace Barotrauma for (int i=0;i 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; }