summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-18 21:34:06 +0000
committerrubidium <rubidium@openttd.org>2009-12-18 21:34:06 +0000
commit6f1982d15149a3649a6ae7f24caaeace8d3809d9 (patch)
treef8e5974c2983ba20abaa8706b31247dd2c5eace8 /src/roadveh_cmd.cpp
parent6f5425a062db70049c7be823004393c88ec714eb (diff)
downloadopenttd-6f1982d15149a3649a6ae7f24caaeace8d3809d9.tar.xz
(svn r18531) -Fix [FS#3384] (r18404): for articulated road vehicles only the first part was accounted for, so for extremely short fronts and lots after it the spreading did not work as it should.
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index ce3ab61d2..1d4b9774f 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -169,6 +169,8 @@ void RoadVehUpdateCache(RoadVehicle *v)
v->InvalidateNewGRFCacheOfChain();
+ v->rcache.cached_total_length = 0;
+
for (RoadVehicle *u = v; u != NULL; u = u->Next()) {
/* Check the v->first cache. */
assert(u->First() == v);
@@ -178,6 +180,7 @@ void RoadVehUpdateCache(RoadVehicle *v)
/* Update the length of the vehicle. */
u->rcache.cached_veh_length = GetRoadVehLength(u);
+ v->rcache.cached_total_length += u->rcache.cached_veh_length;
/* Invalidate the vehicle colour map */
u->colourmap = PAL_NONE;