summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-03 09:22:24 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-03 09:22:24 +0000
commit44f06c8bf02b99c1c158bfdb24c411c554529f05 (patch)
tree123239ecee67253d8657a7f2bff6334fce75a4d9 /train_cmd.c
parentbf0d4ef36f6d6919046956b93eff68d6d53396b6 (diff)
downloadopenttd-44f06c8bf02b99c1c158bfdb24c411c554529f05.tar.xz
(svn r3124) Alter train loading/unloading time to use the actual length of the train instead of the number of wagons. The actual length is cached in the first vehicle of the train.
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/train_cmd.c b/train_cmd.c
index a93093a30..d6d9b08b2 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -83,6 +83,7 @@ void TrainConsistChanged(Vehicle *v) {
rvi_v = RailVehInfo(v->engine_type);
first_engine = (v->subtype == TS_Front_Engine) ? v->engine_type : INVALID_VEHICLE;
+ v->u.rail.cached_total_length = 0;
for (u = v; u != NULL; u = u->next) {
const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
@@ -125,6 +126,7 @@ void TrainConsistChanged(Vehicle *v) {
veh_len = rvi_u->shorten_factor;
veh_len = clamp(veh_len, 0, u->next == NULL ? 7 : 5); // the clamp on vehicles not the last in chain is stricter, as too short wagons can break the 'follow next vehicle' code
u->u.rail.cached_veh_length = 8 - veh_len;
+ v->u.rail.cached_total_length += u->u.rail.cached_veh_length;
};