summaryrefslogtreecommitdiff
path: root/src/vehicle_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r--src/vehicle_base.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index be3a4058f..4eecda6cc 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -23,6 +23,8 @@
#include "transport_type.h"
#include "group_type.h"
#include "base_consist.h"
+#include <list>
+#include <map>
/** Vehicle status bits in #Vehicle::vehstatus. */
enum VehStatus {
@@ -124,15 +126,33 @@ extern void FixOldVehicles();
struct GRFFile;
+/**
+ * Simulated cargo type and capacity for prediction of future links.
+ */
+struct RefitDesc {
+ CargoID cargo; ///< Cargo type the vehicle will be carrying.
+ uint16 capacity; ///< Capacity the vehicle will have.
+ uint16 remaining; ///< Capacity remaining from before the previous refit.
+ RefitDesc(CargoID cargo, uint16 capacity, uint16 remaining) :
+ cargo(cargo), capacity(capacity), remaining(remaining) {}
+};
+
/** %Vehicle data structure. */
struct Vehicle : VehiclePool::PoolItem<&_vehicle_pool>, BaseVehicle, BaseConsist {
private:
+ typedef std::list<RefitDesc> RefitList;
+ typedef std::map<CargoID, uint> CapacitiesMap;
+
Vehicle *next; ///< pointer to the next vehicle in the chain
Vehicle *previous; ///< NOSAVE: pointer to the previous vehicle in the chain
Vehicle *first; ///< NOSAVE: pointer to the first vehicle in the chain
Vehicle *next_shared; ///< pointer to the next vehicle that shares the order
Vehicle *previous_shared; ///< NOSAVE: pointer to the previous vehicle in the shared order chain
+
+ void RefreshNextHopsStats(CapacitiesMap &capacities,
+ RefitList &refit_capacities, const Order *first, const Order *cur,
+ const Order *next, uint hops, bool was_refit, bool has_cargo);
public:
friend const SaveLoad *GetVehicleDescription(VehicleType vt); ///< So we can use private/protected variables in the saveload code
friend void FixOldVehicles();