mirror of https://github.com/OpenTTD/OpenTTD.git
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:
parent
e4fc8ef595
commit
f6b38e8e06
|
@ -2089,23 +2089,20 @@ struct CargoesField {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a piece of cargo column.
|
* Make a piece of cargo column.
|
||||||
* @param cargoes Span of #CargoID (may contain #INVALID_CARGO).
|
* @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.
|
|
||||||
* @note #supp_cargoes and #cust_cargoes should be filled in later.
|
* @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;
|
this->type = CFT_CARGO;
|
||||||
assert(std::size(cargoes) <= std::size(this->u.cargo.vertical_cargoes));
|
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);
|
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;
|
CargoIDComparator comparator;
|
||||||
std::sort(std::begin(this->u.cargo.vertical_cargoes), insert, comparator);
|
std::sort(std::begin(this->u.cargo.vertical_cargoes), insert, comparator);
|
||||||
std::fill(insert, std::end(this->u.cargo.vertical_cargoes), INVALID_CARGO);
|
std::fill(insert, std::end(this->u.cargo.vertical_cargoes), INVALID_CARGO);
|
||||||
this->u.cargo.top_end = top_end;
|
this->u.cargo.top_end = false;
|
||||||
this->u.cargo.bottom_end = bottom_end;
|
this->u.cargo.bottom_end = false;
|
||||||
this->u.cargo.supp_cargoes = 0;
|
this->u.cargo.supp_cargoes = 0;
|
||||||
this->u.cargo.cust_cargoes = 0;
|
this->u.cargo.cust_cargoes = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue