summaryrefslogtreecommitdiff
path: root/src/vehicle_base.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-05-19 14:22:04 +0000
committerrubidium <rubidium@openttd.org>2013-05-19 14:22:04 +0000
commit39474532777a1f7beadfd940abf29292bc39879a (patch)
tree59165ada9556ce5b154ec31cbb994827e7e90fe6 /src/vehicle_base.h
parent0cc3d8df4b79628c702ba1293cdc00c099dd0b60 (diff)
downloadopenttd-39474532777a1f7beadfd940abf29292bc39879a.tar.xz
(svn r25259) -Codechange: track capacities and usage of links
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r--src/vehicle_base.h18
1 files changed, 18 insertions, 0 deletions
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<CargoID, uint> &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.