From 39474532777a1f7beadfd940abf29292bc39879a Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 19 May 2013 14:22:04 +0000 Subject: (svn r25259) -Codechange: track capacities and usage of links --- src/vehicle_base.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/vehicle_base.h') diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 7b40d4819..62fcb24ab 100644 --- 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 * @@ -597,6 +604,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), -- cgit v1.2.3-54-g00ecf