summaryrefslogtreecommitdiff
path: root/vehicle.h
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-11-07 23:20:47 +0000
committerbjarni <bjarni@openttd.org>2005-11-07 23:20:47 +0000
commitdf6c48fdba7933e30a16c82e69d8d57ab9515e6d (patch)
tree419d4e9a7f19cca429bc209799068506c9d20f9d /vehicle.h
parent1258ca0bf0beeb045a6f039c900f31658b8c331b (diff)
downloadopenttd-df6c48fdba7933e30a16c82e69d8d57ab9515e6d.tar.xz
(svn r3155) -Feature: [autoreplace] autoreplace can now remove cars from too long trains
-Trains will now remember the length of stations it visits and sell cars when being autoreplaced if they became too long -If it needs to remove cars, then it starts from the front and sells all it can find until the train is short enough -This only works for trains, that knows the station length of the route so a full uninterrupted run is needed -a train needs 1-2 runs to detect if the shortest station is expanded -This feature can be turned on and off in the train replace window and each company can have it's own setting -NOTE: minor savegame version bump
Diffstat (limited to 'vehicle.h')
-rw-r--r--vehicle.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/vehicle.h b/vehicle.h
index 91921d4ba..f5eb66db6 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -85,6 +85,14 @@ typedef struct VehicleRail {
byte pbs_status;
TileIndex pbs_end_tile;
Trackdir pbs_end_trackdir;
+
+ /**
+ * stuff to figure out how long a train should be. Used by autoreplace
+ * first byte holds the length of the shortest station. Updated each time order 0 is reached
+ * last byte is the shortest station reached this round though the orders. It can be invalidated by
+ * skip station and alike by setting it to 0. That way we will ensure that a complete loop is used to find the shortest station
+ */
+ byte shortest_platform[2];
} VehicleRail;
enum {
@@ -177,7 +185,6 @@ struct Vehicle {
int32 x_pos; // coordinates
int32 y_pos;
- bool leave_depot_instantly; // NOSAVE: stores if the vehicle needs to leave the depot it just entered. Used by autoreplace
byte z_pos;
byte direction; // facing
@@ -248,6 +255,8 @@ struct Vehicle {
byte breakdown_chance;
byte build_year;
+ bool leave_depot_instantly; // NOSAVE: stores if the vehicle needs to leave the depot it just entered. Used by autoreplace
+
uint16 load_unload_time_rem;
int32 profit_this_year;