about summary refs log tree commit diff
diff options
context:
space:
mode:
authorxalduin <xalduin@gmail.com>2010-06-01 20:47:10 -0400
committerxalduin <xalduin@gmail.com>2010-06-01 20:47:10 -0400
commit7454cec57e5de0983464991145979dc3c885d39e (patch)
tree1943a8984679cfd9fbb064bb5a81f3adca5061a0
parentf963189dc4bd94395dd1831b48cb900218a7347f (diff)
downloadzcatch-7454cec57e5de0983464991145979dc3c885d39e.tar.gz
zcatch-7454cec57e5de0983464991145979dc3c885d39e.zip
Start of image sorting
-rw-r--r--src/game/editor/ed_editor.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp
index b2b3e1ca..0a5c22d3 100644
--- a/src/game/editor/ed_editor.cpp
+++ b/src/game/editor/ed_editor.cpp
@@ -1,5 +1,7 @@
 // copyright (c) 2007 magnus auvinen, see licence.txt for more info
 
+#include <stdlib.h>
+
 #include <base/system.h>
 #include <base/tl/sorted_array.h>
 #include <base/tl/string.h>
@@ -1809,9 +1811,17 @@ int CEditor::PopupImage(CEditor *pEditor, CUIRect View)
 	return 0;
 }
 
+static int CompareImageName(const void *Object1, const void *Object2)
+{
+	CEditorImage *Image1 = *(CEditorImage**)Object1;
+	CEditorImage *Image2 = *(CEditorImage**)Object2;
+	return str_comp(Image1->m_aName, Image2->m_aName);
+}
 
 void CEditor::RenderImages(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
 {
+	qsort(m_Map.m_lImages.base_ptr(), m_Map.m_lImages.size(), sizeof(CEditorImage*), CompareImageName);
+
 	for(int e = 0; e < 2; e++) // two passes, first embedded, then external
 	{
 		CUIRect Slot;