summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-10-11 18:44:02 +0000
committerpeter1138 <peter1138@openttd.org>2006-10-11 18:44:02 +0000
commit75fe56eff07f746b7884411b879cb8d6938aab0a (patch)
tree0ec31e00ebe989e2322ca96c82d4e6b442f971d3
parent8d2bf451234790c08fe42303fe02337791f52913 (diff)
downloadopenttd-75fe56eff07f746b7884411b879cb8d6938aab0a.tar.xz
(svn r6737) - Codechange: Sort train engines by their NewGRF specified list position instead of plain EngineID. This brings us back the custom order that was lost when generalized sorting was introduced.
-rw-r--r--train_gui.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/train_gui.c b/train_gui.c
index 292d88f5c..7ae1a3bbe 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -69,7 +69,7 @@ static int CDECL TrainEngineNumberSorter(const void *a, const void *b)
{
const EngineID va = *(const EngineID*)a;
const EngineID vb = *(const EngineID*)b;
- int r = va - vb;
+ int r = ListPositionOfEngine(va) - ListPositionOfEngine(vb);
return _internal_sort_order ? -r : r;
}
@@ -415,7 +415,7 @@ static void GenerateBuildList(EngineID **engines, uint16 *num_engines, EngineID
if (wagons == NULL) ExtendEngineListSize((const EngineID**)wagons, &wagon_length, 25);
for (j = 0; j < NUM_TRAIN_ENGINES; j++) {
- EngineID i = GetRailVehAtPosition(j);
+ EngineID i = GetRailVehAtPosition(j); // XXX Can be removed when the wagon list is also sorted.
const Engine *e = GetEngine(i);
const RailVehicleInfo *rvi = RailVehInfo(i);