From f954a93ee00ec9f7c69afc306e8346d80ccbb432 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Wed, 28 May 2008 17:29:27 +0000 Subject: (svn r13314) -Codechange: Switch EngineList from std::vector to GUIList --- src/engine_gui.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/engine_gui.cpp') diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index bd48d778a..c9bd05650 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -197,13 +197,13 @@ void DrawNewsNewVehicleAvail(Window *w, const NewsItem *ni) * @param el list to be sorted * @param compare function for evaluation of the quicksort */ -void EngList_Sort(EngineList *el, EngList_SortTypeFunction compare) +void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare) { - size_t size = el->size(); + uint size = el->Length(); /* 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)[0]), size, sizeof(EngineID), compare); // MorphOS doesn't know vector::at(int) ... + qsort(el->Begin(), size, sizeof(*el->Begin()), compare); // MorphOS doesn't know vector::at(int) ... } /** Sort selected range of items (on indices @ ) @@ -212,11 +212,11 @@ void EngList_Sort(EngineList *el, EngList_SortTypeFunction compare) * @param begin start of sorting * @param num_items count of items to be sorted */ -void EngList_SortPartial(EngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items) +void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items) { - assert(begin <= (uint)el->size()); - assert(begin + num_items <= (uint)el->size()); + assert(begin < el->Length()); + assert(begin + num_items <= el->Length()); if (num_items < 2) return; - qsort(&((*el)[begin]), num_items, sizeof(EngineID), compare); + qsort(el->Get(begin), num_items, sizeof(*el->Begin()), compare); } -- cgit v1.2.3-54-g00ecf