* Determines order of ships 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 */
| 376 | * @return for descending order: returns true if a < b. Vice versa for ascending order |
| 377 | */ |
| 378 | static bool ShipEngineCapacitySorter(const GUIEngineListItem &a, const GUIEngineListItem &b) |
| 379 | { |
| 380 | const Engine *e_a = Engine::Get(a.engine_id); |
| 381 | const Engine *e_b = Engine::Get(b.engine_id); |
| 382 | |
| 383 | int va = e_a->GetDisplayDefaultCapacity(); |
| 384 | int vb = e_b->GetDisplayDefaultCapacity(); |
| 385 | int r = va - vb; |
| 386 | |
| 387 | /* Use EngineID to sort instead since we want consistent sorting */ |
| 388 | if (r == 0) return EngineNumberSorter(a, b); |
| 389 | return _engine_sort_direction ? r > 0 : r < 0; |
| 390 | } |
| 391 | |
| 392 | /* Aircraft sorting functions */ |
| 393 |
nothing calls this directly
no test coverage detected