15 #include "../cargo_type.h" 16 #include "../vehicle_base.h" 49 cargo(cargo), capacity(capacity), remaining(remaining) {}
70 Hop() {NOT_REACHED();}
78 Hop(OrderID from, OrderID to,
CargoID cargo) : from(from), to(to), cargo(cargo) {}
79 bool operator<(
const Hop &other)
const;
82 typedef std::vector<RefitDesc> RefitList;
83 typedef std::set<Hop> HopSet;
CargoID cargo
Cargo the consist is probably carrying or CT_INVALID if unknown.
OrderID from
Last order where vehicle could interact with cargo or absolute first order.
Consist had a chance to load since the last refit and the refit capacities can be reset...
void RefreshStats(const Order *cur, const Order *next)
Refresh link stats for the given pair of orders.
CargoID cargo
Cargo given in last refit order.
bool is_full_loading
If the vehicle is full loading.
Hop()
Default constructor should not be called but has to be visible for usage in std::set.
uint16 capacity
Capacity the vehicle will have.
void ResetRefit()
Restore capacities and refit_capacities as vehicle might have been able to load now.
CargoID cargo
Cargo type the vehicle will be carrying.
Consist could leave the last stop where it could interact with cargo carrying cargo (i...
Vehicle * vehicle
Vehicle for which the links should be refreshed.
uint capacities[NUM_CARGO]
Current added capacities per cargo ID in the consist.
bool allow_merge
If the refresher is allowed to merge or extend link graphs.
Hop(OrderID from, OrderID to, CargoID cargo)
Real constructor, only use this one.
static void Run(Vehicle *v, bool allow_merge=true, bool is_full_loading=false)
Refresh all links the given vehicle will visit.
OrderID to
Next order to be processed.
HopSet * seen_hops
Hops already seen. If the same hop is seen twice we stop the algorithm. This is shared between all Re...
const Order * PredictNextOrder(const Order *cur, const Order *next, uint8 flags, uint num_hops=0)
Predict the next order the vehicle will execute and resolve conditionals by recursion and return next...
Currently doing an autorefit loop. Ignore the first autorefit order.
void RefreshLinks(const Order *cur, const Order *next, uint8 flags, uint num_hops=0)
Iterate over orders starting at cur and next and refresh links associated with them.
A hop the refresh algorithm might evaluate.
LinkRefresher(Vehicle *v, HopSet *seen_hops, bool allow_merge, bool is_full_loading)
Constructor for link refreshing algorithm.
Maximal number of cargo types in a game.
RefitList refit_capacities
Current state of capacity remaining from previous refits versus overall capacity per vehicle in the c...
RefreshFlags
Various flags about properties of the last examined link that might have an influence on the next one...
bool HandleRefit(CargoID refit_cargo)
Handle refit orders by updating capacities and refit_capacities.
There was a conditional jump. Try to use the given next order when looking for a new one...
byte CargoID
Cargo slots to indicate a cargo type within a game.
Simulated cargo type and capacity for prediction of future links.
uint16 remaining
Capacity remaining from before the previous refit.
Consist was refit since the last stop where it could interact with cargo.
Utility to refresh links a consist will visit.