mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use CargoArray for linkgraph refresher. (#13165)
`uint capacities[NUM_CARGO]` looks a lot like CargoArray.pull/13166/head
parent
677bd52c65
commit
56510b5d7b
|
@ -70,8 +70,6 @@ LinkRefresher::LinkRefresher(Vehicle *vehicle, HopSet *seen_hops, bool allow_mer
|
||||||
vehicle(vehicle), seen_hops(seen_hops), cargo(INVALID_CARGO), allow_merge(allow_merge),
|
vehicle(vehicle), seen_hops(seen_hops), cargo(INVALID_CARGO), allow_merge(allow_merge),
|
||||||
is_full_loading(is_full_loading)
|
is_full_loading(is_full_loading)
|
||||||
{
|
{
|
||||||
memset(this->capacities, 0, sizeof(this->capacities));
|
|
||||||
|
|
||||||
/* Assemble list of capacities and set last loading stations to 0. */
|
/* Assemble list of capacities and set last loading stations to 0. */
|
||||||
for (Vehicle *v = this->vehicle; v != nullptr; v = v->Next()) {
|
for (Vehicle *v = this->vehicle; v != nullptr; v = v->Next()) {
|
||||||
this->refit_capacities.push_back(RefitDesc(v->cargo_type, v->cargo_cap, v->refit_cap));
|
this->refit_capacities.push_back(RefitDesc(v->cargo_type, v->cargo_cap, v->refit_cap));
|
||||||
|
|
|
@ -78,7 +78,7 @@ protected:
|
||||||
typedef std::set<Hop> HopSet;
|
typedef std::set<Hop> HopSet;
|
||||||
|
|
||||||
Vehicle *vehicle; ///< Vehicle for which the links should be refreshed.
|
Vehicle *vehicle; ///< Vehicle for which the links should be refreshed.
|
||||||
uint capacities[NUM_CARGO]; ///< Current added capacities per cargo ID in the consist.
|
CargoArray capacities; ///< Current added capacities per cargo ID in the consist.
|
||||||
RefitList refit_capacities; ///< Current state of capacity remaining from previous refits versus overall capacity per vehicle in the consist.
|
RefitList refit_capacities; ///< Current state of capacity remaining from previous refits versus overall capacity per vehicle in the consist.
|
||||||
HopSet *seen_hops; ///< Hops already seen. If the same hop is seen twice we stop the algorithm. This is shared between all Refreshers of the same run.
|
HopSet *seen_hops; ///< Hops already seen. If the same hop is seen twice we stop the algorithm. This is shared between all Refreshers of the same run.
|
||||||
CargoID cargo; ///< Cargo given in last refit order.
|
CargoID cargo; ///< Cargo given in last refit order.
|
||||||
|
|
Loading…
Reference in New Issue