* Determines order of road vehicles by capacity * @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 */
| 357 | * @return for descending order: returns true if a < b. Vice versa for ascending order |
| 358 | */ |
| 359 | static bool RoadVehEngineCapacitySorter(const GUIEngineListItem &a, const GUIEngineListItem &b) |
| 360 | { |
| 361 | int va = GetTotalCapacityOfArticulatedParts(a.engine_id); |
| 362 | int vb = GetTotalCapacityOfArticulatedParts(b.engine_id); |
| 363 | int r = va - vb; |
| 364 | |
| 365 | /* Use EngineID to sort instead since we want consistent sorting */ |
| 366 | if (r == 0) return EngineNumberSorter(a, b); |
| 367 | return _engine_sort_direction ? r > 0 : r < 0; |
| 368 | } |
| 369 | |
| 370 | /* Ship vehicle sorting functions */ |
| 371 |
nothing calls this directly
no test coverage detected