Mercurial > hg > openttd
changeset 8174:4e1dc52549ca draft
(svn r11737) -Fix: Reinstate NewGRF-specified engine list order in autoreplace window.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Tue, 01 Jan 2008 17:01:06 +0000 |
parents | 2fe829d9da15 |
children | b6a2bebbaaed |
files | src/autoreplace_gui.cpp |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -31,6 +31,15 @@ INVALID_STRING_ID }; +static int CDECL TrainEngineNumberSorter(const void *a, const void *b) +{ + const EngineID va = *(const EngineID*)a; + const EngineID vb = *(const EngineID*)b; + int r = ListPositionOfEngine(va) - ListPositionOfEngine(vb); + + return r; +} + /* General Vehicle GUI based procedures that are independent of vehicle types */ void InitializeVehiclesGuiList() { @@ -172,6 +181,7 @@ if (e == WP(w, replaceveh_d).sel_engine[i]) selected_engine = e; // The selected engine is still in the list } WP(w, replaceveh_d).sel_engine[i] = selected_engine; // update which engine we selected (the same or none, if it's not in the list anymore) + if (type == VEH_TRAIN) EngList_Sort(list, &TrainEngineNumberSorter); } /** Generate the lists