diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 66f5ad12b7..6beffe9a73 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -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 cargoes, int count = -1, bool top_end = false, bool bottom_end = false) + void MakeCargo(const std::span 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(insert - std::begin(this->u.cargo.vertical_cargoes)) : count; + this->u.cargo.num_cargoes = static_cast(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; }