Codechange: unify documentation and parameter names of sorters

This commit is contained in:
Rubidium
2026-02-11 04:53:39 +01:00
committed by rubidium42
parent 83f58b3fbd
commit 8e75626b49
20 changed files with 116 additions and 190 deletions
+6 -6
View File
@@ -234,7 +234,7 @@ void GetCargoSuffix(CargoSuffixInOut use_input, CargoSuffixType cst, const Indus
std::array<IndustryType, NUM_INDUSTRYTYPES> _sorted_industry_types; ///< Industry types sorted by name.
/** Sort industry types by their name. */
/** Sort industry types by their name. @copydoc GUIList::Sorter */
static bool IndustryTypeNameSorter(const IndustryType &a, const IndustryType &b)
{
int r = StrNaturalCompare(GetString(GetIndustrySpec(a)->name), GetString(GetIndustrySpec(b)->name)); // Sort by name (natural sorting).
@@ -1499,15 +1499,15 @@ protected:
return percentage / produced_cargo_count;
}
/** Sort industries by name */
static bool IndustryNameSorter(const Industry * const &a, const Industry * const &b, const CargoType &)
/** Sort industries by name. @copydoc GUIList::SorterWithFilter */
static bool IndustryNameSorter(const Industry * const &a, const Industry * const &b, [[maybe_unused]] const CargoType &filter)
{
int r = StrNaturalCompare(a->GetCachedName(), b->GetCachedName()); // Sort by name (natural sorting).
if (r == 0) return a->index < b->index;
return r < 0;
}
/** Sort industries by type and name */
/** Sort industries by type and name. @copydoc GUIList::SorterWithFilter */
static bool IndustryTypeSorter(const Industry * const &a, const Industry * const &b, const CargoType &filter)
{
int it_a = 0;
@@ -1518,7 +1518,7 @@ protected:
return (r == 0) ? IndustryNameSorter(a, b, filter) : r < 0;
}
/** Sort industries by production and name */
/** Sort industries by production and name. @copydoc GUIList::SorterWithFilter */
static bool IndustryProductionSorter(const Industry * const &a, const Industry * const &b, const CargoType &filter)
{
if (filter == CargoFilterCriteria::CF_NONE) return IndustryTypeSorter(a, b, filter);
@@ -1540,7 +1540,7 @@ protected:
return (r == 0) ? IndustryTypeSorter(a, b, filter) : r < 0;
}
/** Sort industries by transported cargo and name */
/** Sort industries by transported cargo and name. @copydoc GUIList::SorterWithFilter */
static bool IndustryTransportedCargoSorter(const Industry * const &a, const Industry * const &b, const CargoType &filter)
{
int r = GetCargoTransportedSortValue(a) - GetCargoTransportedSortValue(b);