diff --git a/src/vehicle_base.h b/src/vehicle_base.h --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -12,6 +12,7 @@ #ifndef VEHICLE_BASE_H #define VEHICLE_BASE_H +#include "core/smallmap_type.hpp" #include "track_type.h" #include "command_type.h" #include "order_base.h" @@ -211,10 +212,12 @@ public: byte waiting_triggers; ///< Triggers to be yet matched before rerandomizing the random bits. StationID last_station_visited; ///< The last station we stopped at. + StationID last_loading_station; ///< Last station the vehicle has stopped at and could possibly leave from with any cargo loaded. CargoID cargo_type; ///< type of cargo this vehicle is carrying byte cargo_subtype; ///< Used for livery refits (NewGRF variations) uint16 cargo_cap; ///< total capacity + uint16 refit_cap; ///< Capacity left over from before last refit. VehicleCargoList cargo; ///< The cargo this vehicle is carrying uint16 cargo_age_counter; ///< Ticks till cargo is aged next. @@ -257,6 +260,10 @@ public: void HandleLoading(bool mode = false); + void GetConsistFreeCapacities(SmallMap &capacities) const; + + uint GetConsistTotalCapacity() const; + /** * Marks the vehicles to be redrawn and updates cached variables * @@ -598,6 +605,17 @@ public: inline VehicleOrderID GetNumManualOrders() const { return (this->orders.list == NULL) ? 0 : this->orders.list->GetNumManualOrders(); } /** + * Get the next station the vehicle will stop at. + * @return ID of the next station the vehicle will stop at or INVALID_STATION. + */ + inline StationID GetNextStoppingStation() const + { + return (this->orders.list == NULL) ? INVALID_STATION : this->orders.list->GetNextStoppingStation(this); + } + + void RefreshNextHopsStats(); + + /** * Copy certain configurations and statistics of a vehicle after successful autoreplace/renew * The function shall copy everything that cannot be copied by a command (like orders / group etc), * and that shall not be resetted for the new vehicle.