Codechange: Use EnumBitSet for CargoClasses. (#13491)

This commit is contained in:
Peter Nelson
2025-02-08 08:46:38 +00:00
committed by GitHub
parent 04d53ed6f5
commit d61b376998
18 changed files with 157 additions and 160 deletions

View File

@@ -285,9 +285,9 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
/* Prioritize the fastest route for passengers, mail and express cargo,
* and the shortest route for other classes of cargo.
* In-between stops are punished with a 1 tile or 1 day penalty. */
bool express = IsCargoInClass(this->job.Cargo(), CC_PASSENGERS) ||
IsCargoInClass(this->job.Cargo(), CC_MAIL) ||
IsCargoInClass(this->job.Cargo(), CC_EXPRESS);
bool express = IsCargoInClass(this->job.Cargo(), CargoClass::Passengers) ||
IsCargoInClass(this->job.Cargo(), CargoClass::Mail) ||
IsCargoInClass(this->job.Cargo(), CargoClass::Express);
uint distance = DistanceMaxPlusManhattan(this->job[from].base.xy, this->job[to].base.xy) + 1;
/* Compute a default travel time from the distance and an average speed of 1 tile/day. */
uint time = (edge.base.TravelTime() != 0) ? edge.base.TravelTime() + Ticks::DAY_TICKS : distance * Ticks::DAY_TICKS;