summaryrefslogtreecommitdiff
path: root/economy.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
commite80d448478746ba30f1f78ad809e14703c7b899a (patch)
tree123239ecee67253d8657a7f2bff6334fce75a4d9 /economy.c
parent689006ee738c8866d05161cb8bbdd6d9a6472252 (diff)
downloadopenttd-e80d448478746ba30f1f78ad809e14703c7b899a.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 'economy.c')
-rw-r--r--economy.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/economy.c b/economy.c
index 16111d826..00490a166 100644
--- a/economy.c
+++ b/economy.c
@@ -1463,13 +1463,12 @@ int LoadUnloadVehicle(Vehicle *v)
ShowFeederIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, v_profit_total);
if (v->type == VEH_Train) {
- int num = - (int)GetStationPlatforms(st, v->tile) * 2;
- do num++; while ( (v=v->next) != NULL);
- if (num > 0) {
- unloading_time <<=1;
- unloading_time += num * unloading_time;
+ // Each platform tile is worth 2 rail vehicles.
+ int overhang = v->u.rail.cached_total_length - GetStationPlatforms(st, v->tile) * 16;
+ if (overhang > 0) {
+ unloading_time <<= 1;
+ unloading_time += (overhang * unloading_time) / 8;
}
- v = u;
}
v->load_unload_time_rem = unloading_time;