Codechange: Use EnumBitSet for Linkgraph RefreshFlags. (#13930)

This commit is contained in:
Peter Nelson
2025-03-31 20:33:32 +01:00
committed by GitHub
parent 047497734b
commit e200e9b401
2 changed files with 29 additions and 28 deletions
+10 -8
View File
@@ -25,14 +25,16 @@ protected:
* Various flags about properties of the last examined link that might have
* an influence on the next one.
*/
enum RefreshFlags : uint8_t {
USE_NEXT, ///< There was a conditional jump. Try to use the given next order when looking for a new one.
HAS_CARGO, ///< Consist could leave the last stop where it could interact with cargo carrying cargo (i.e. not an "unload all" + "no loading" order).
WAS_REFIT, ///< Consist was refit since the last stop where it could interact with cargo.
RESET_REFIT, ///< Consist had a chance to load since the last refit and the refit capacities can be reset.
IN_AUTOREFIT, ///< Currently doing an autorefit loop. Ignore the first autorefit order.
enum class RefreshFlag : uint8_t {
UseNext, ///< There was a conditional jump. Try to use the given next order when looking for a new one.
HasCargo, ///< Consist could leave the last stop where it could interact with cargo carrying cargo (i.e. not an "unload all" + "no loading" order).
WasRefit, ///< Consist was refit since the last stop where it could interact with cargo.
ResetRefit, ///< Consist had a chance to load since the last refit and the refit capacities can be reset.
InAutorefit, ///< Currently doing an autorefit loop. Ignore the first autorefit order.
};
using RefreshFlags = EnumBitSet<RefreshFlag, uint8_t>;
/**
* Simulated cargo type and capacity for prediction of future links.
*/
@@ -90,9 +92,9 @@ protected:
bool HandleRefit(CargoType refit_cargo);
void ResetRefit();
void RefreshStats(const Order *cur, const Order *next);
const Order *PredictNextOrder(const Order *cur, const Order *next, uint8_t flags, uint num_hops = 0);
const Order *PredictNextOrder(const Order *cur, const Order *next, RefreshFlags flags, uint num_hops = 0);
void RefreshLinks(const Order *cur, const Order *next, uint8_t flags, uint num_hops = 0);
void RefreshLinks(const Order *cur, const Order *next, RefreshFlags flags, uint num_hops = 0);
};
#endif /* REFRESH_H */