Browse Source

remove shameful editor bubblesort

Chris Friesen 12 năm trước cách đây
mục cha
commit
7aa825551b
1 tập tin đã thay đổi với 5 bổ sung17 xóa
  1. 5 17
      Bin/Data/Scripts/Editor/EditorUI.as

+ 5 - 17
Bin/Data/Scripts/Editor/EditorUI.as

@@ -187,23 +187,7 @@ void PerformQuickMenuSearch(const String&in query)
             }
         }
 
-        {
-            QuickMenuItem@ a;
-            QuickMenuItem@ b;
-            for (uint x=0; x < filtered.length; x++)
-            {
-                for (uint y=0; y < filtered.length-1; y++)
-                {
-                    @a = filtered[y];
-                    @b = filtered[y+1];
-                    if(a.sortScore > b.sortScore)
-                    {
-                        @filtered[y+1] = a;
-                        @filtered[y] = b;
-                    }
-                }
-            }
-        }
+        filtered.Sort();
 
         {
             QuickMenuItem@ qi;
@@ -235,6 +219,10 @@ class QuickMenuItem
         this.action = action;
         this.callback = callback;
     }
+    int opCmp(QuickMenuItem@ b)
+    {
+        return sortScore - b.sortScore;
+    }
 }
 
 /// Create popup search menu.