summaryrefslogtreecommitdiff
path: root/src/engine_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-13 17:47:07 +0000
committerrubidium <rubidium@openttd.org>2009-09-13 17:47:07 +0000
commit17313b6e3f875055c148e3543eea9027e554ca70 (patch)
treeee1bbc7447553ce6f33025b58f091867bf099452 /src/engine_gui.cpp
parente4809052c33f1c090b70ec32953ca7592ec7735e (diff)
downloadopenttd-17313b6e3f875055c148e3543eea9027e554ca70.tar.xz
(svn r17530) -Codechange: use QSortT instead of qsort for sorting EngineIDs
Diffstat (limited to 'src/engine_gui.cpp')
-rw-r--r--src/engine_gui.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index c6f3d02e9..a70967688 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -23,6 +23,7 @@
#include "vehicle_func.h"
#include "company_func.h"
#include "rail.h"
+#include "core/sort_func.hpp"
#include "table/strings.h"
#include "table/sprites.h"
@@ -263,7 +264,7 @@ void DrawVehicleEngine(int x, int y, EngineID engine, SpriteID pal)
}
}
-/** Sort all items using qsort() and given 'CompareItems' function
+/** Sort all items using quick sort and given 'CompareItems' function
* @param el list to be sorted
* @param compare function for evaluation of the quicksort
*/
@@ -273,7 +274,7 @@ void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare)
/* out-of-bounds access at the next line for size == 0 (even with operator[] at some systems)
* generally, do not sort if there are less than 2 items */
if (size < 2) return;
- qsort(el->Begin(), size, sizeof(*el->Begin()), compare); // MorphOS doesn't know vector::at(int) ...
+ QSortT(el->Begin(), size, compare);
}
/** Sort selected range of items (on indices @ <begin, begin+num_items-1>)
@@ -287,6 +288,6 @@ void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, ui
if (num_items < 2) return;
assert(begin < el->Length());
assert(begin + num_items <= el->Length());
- qsort(el->Get(begin), num_items, sizeof(*el->Begin()), compare);
+ QSortT(el->Get(begin), num_items, compare);
}