# HG changeset patch # User peter1138 # Date 1160592242 0 # Node ID 96eb742c98a0987b2b021502f4ec619145866d1f # Parent d71b2e7d11e05bf95272d95b4421b2c73f578d3d (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. diff -r d71b2e7d11e0 -r 96eb742c98a0 train_gui.c --- a/train_gui.c Wed Oct 11 18:35:40 2006 +0000 +++ b/train_gui.c Wed Oct 11 18:44:02 2006 +0000 @@ -69,7 +69,7 @@ { 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 @@ 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);