mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(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.
This commit is contained in:
parent
8d2bf45123
commit
75fe56eff0
@ -69,7 +69,7 @@ static int CDECL TrainEngineNumberSorter(const void *a, const void *b)
|
|||||||
{
|
{
|
||||||
const EngineID va = *(const EngineID*)a;
|
const EngineID va = *(const EngineID*)a;
|
||||||
const EngineID vb = *(const EngineID*)b;
|
const EngineID vb = *(const EngineID*)b;
|
||||||
int r = va - vb;
|
int r = ListPositionOfEngine(va) - ListPositionOfEngine(vb);
|
||||||
|
|
||||||
return _internal_sort_order ? -r : r;
|
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);
|
if (wagons == NULL) ExtendEngineListSize((const EngineID**)wagons, &wagon_length, 25);
|
||||||
|
|
||||||
for (j = 0; j < NUM_TRAIN_ENGINES; j++) {
|
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 Engine *e = GetEngine(i);
|
||||||
const RailVehicleInfo *rvi = RailVehInfo(i);
|
const RailVehicleInfo *rvi = RailVehInfo(i);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user