diff options
author | peter1138 <peter1138@openttd.org> | 2008-05-28 17:29:27 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-05-28 17:29:27 +0000 |
commit | f954a93ee00ec9f7c69afc306e8346d80ccbb432 (patch) | |
tree | 08d42b0dc303e2f3691a402d44db0a3dcdb9d86a /src/engine_gui.cpp | |
parent | f44a2c38f8887a2f9d6d3e6111d7d00537033274 (diff) | |
download | openttd-f954a93ee00ec9f7c69afc306e8346d80ccbb432.tar.xz |
(svn r13314) -Codechange: Switch EngineList from std::vector to GUIList
Diffstat (limited to 'src/engine_gui.cpp')
-rw-r--r-- | src/engine_gui.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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 @ <begin, begin+num_items-1>) @@ -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); } |