MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / EngineNumberSorter

Function EngineNumberSorter

src/build_vehicle_gui.cpp:116–121  ·  view source on GitHub ↗

* Determines order of engines by engineID * @param a first engine to compare * @param b second engine to compare * @return for descending order: returns true if a < b. Vice versa for ascending order */

Source from the content-addressed store, hash-verified

114 * @return for descending order: returns true if a < b. Vice versa for ascending order
115 */
116static bool EngineNumberSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
117{
118 int r = Engine::Get(a.engine_id)->list_position - Engine::Get(b.engine_id)->list_position;
119
120 return _engine_sort_direction ? r > 0 : r < 0;
121}
122
123/**
124 * Determines order of engines by introduction date

Callers 15

EngineIntroDateSorterFunction · 0.70
EngineNameSorterFunction · 0.70
EngineReliabilitySorterFunction · 0.70
EngineCostSorterFunction · 0.70
EngineSpeedSorterFunction · 0.70
EnginePowerSorterFunction · 0.70
EngineRunningCostSorterFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected