Codechange: Remove optional MakeCargo() parameters that are never changed.

Default values are always used, so don't need to be parameters.
This commit is contained in:
Peter Nelson 2024-03-25 21:07:34 +00:00 committed by Peter Nelson
parent e4fc8ef595
commit f6b38e8e06
1 changed files with 5 additions and 8 deletions

View File

@ -2089,23 +2089,20 @@ struct CargoesField {
/**
* Make a piece of cargo column.
* @param cargoes Span of #CargoID (may contain #INVALID_CARGO).
* @param count Number of cargoes to display (should be at least the number of valid cargoes, or \c -1 to let the method compute it).
* @param top_end This is the first cargo field of this column.
* @param bottom_end This is the last cargo field of this column.
* @param cargoes Span of #CargoID (may contain #INVALID_CARGO).
* @note #supp_cargoes and #cust_cargoes should be filled in later.
*/
void MakeCargo(const std::span<const CargoID> cargoes, int count = -1, bool top_end = false, bool bottom_end = false)
void MakeCargo(const std::span<const CargoID> cargoes)
{
this->type = CFT_CARGO;
assert(std::size(cargoes) <= std::size(this->u.cargo.vertical_cargoes));
auto insert = std::copy_if(std::begin(cargoes), std::end(cargoes), std::begin(this->u.cargo.vertical_cargoes), IsValidCargoID);
this->u.cargo.num_cargoes = (count < 0) ? static_cast<uint8_t>(insert - std::begin(this->u.cargo.vertical_cargoes)) : count;
this->u.cargo.num_cargoes = static_cast<uint8_t>(std::distance(std::begin(this->u.cargo.vertical_cargoes), insert));
CargoIDComparator comparator;
std::sort(std::begin(this->u.cargo.vertical_cargoes), insert, comparator);
std::fill(insert, std::end(this->u.cargo.vertical_cargoes), INVALID_CARGO);
this->u.cargo.top_end = top_end;
this->u.cargo.bottom_end = bottom_end;
this->u.cargo.top_end = false;
this->u.cargo.bottom_end = false;
this->u.cargo.supp_cargoes = 0;
this->u.cargo.cust_cargoes = 0;
}