13#include "../cargo_type.h"
14#include "../vehicle_base.h"
67 Hop() {NOT_REACHED();}
77 constexpr auto operator<=>(
const Hop &)
const noexcept =
default;
80 typedef std::vector<RefitDesc> RefitList;
81 typedef std::set<Hop> HopSet;
uint8_t CargoType
Cargo slots to indicate a cargo type within a game.
Utility to refresh links a consist will visit.
bool allow_merge
If the refresher is allowed to merge or extend link graphs.
void ResetRefit()
Restore capacities and refit_capacities as vehicle might have been able to load now.
VehicleOrderID PredictNextOrder(VehicleOrderID cur, VehicleOrderID next, RefreshFlags flags, uint num_hops=0)
Predict the next order the vehicle will execute and resolve conditionals by recursion and return next...
void RefreshLinks(VehicleOrderID cur, VehicleOrderID next, RefreshFlags flags, uint num_hops=0)
Iterate over orders starting at cur and next and refresh links associated with them.
void RefreshStats(VehicleOrderID cur, VehicleOrderID next)
Refresh link stats for the given pair of orders.
bool HandleRefit(CargoType refit_cargo)
Handle refit orders by updating capacities and refit_capacities.
Vehicle * vehicle
Vehicle for which the links should be refreshed.
RefreshFlag
Various flags about properties of the last examined link that might have an influence on the next one...
@ UseNext
There was a conditional jump. Try to use the given next order when looking for a new one.
@ WasRefit
Consist was refit since the last stop where it could interact with cargo.
@ HasCargo
Consist could leave the last stop where it could interact with cargo carrying cargo (i....
@ InAutorefit
Currently doing an autorefit loop. Ignore the first autorefit order.
RefitList refit_capacities
Current state of capacity remaining from previous refits versus overall capacity per vehicle in the c...
CargoType cargo
Cargo given in last refit order.
CargoArray capacities
Current added capacities per cargo type 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 Re...
bool is_full_loading
If the vehicle is full loading.
static void Run(Vehicle *v, bool allow_merge=true, bool is_full_loading=false)
Refresh all links the given vehicle will visit.
uint8_t VehicleOrderID
The index of an order within its current vehicle (not pool related)
Class for storing amounts of cargo.
A hop the refresh algorithm might evaluate.
VehicleOrderID from
Last order where vehicle could interact with cargo or absolute first order.
Hop()
Default constructor should not be called but has to be visible for usage in std::set.
Hop(VehicleOrderID from, VehicleOrderID to, CargoType cargo)
Real constructor, only use this one.
CargoType cargo
Cargo the consist is probably carrying or INVALID_CARGO if unknown.
VehicleOrderID to
Next order to be processed.
Simulated cargo type and capacity for prediction of future links.
CargoType cargo
Cargo type the vehicle will be carrying.
uint16_t remaining
Capacity remaining from before the previous refit.
uint16_t capacity
Capacity the vehicle will have.