diff options
author | terkhen <terkhen@openttd.org> | 2010-12-14 21:33:53 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-12-14 21:33:53 +0000 |
commit | 48b7916458de4b2cdbc226a4a6ab078db4c77e73 (patch) | |
tree | c3a49ca7a91890042ca56765574bc40a54c15f96 /src/articulated_vehicles.cpp | |
parent | a93944e765776c6e9a2bd556457cd93748068da6 (diff) | |
download | openttd-48b7916458de4b2cdbc226a4a6ab078db4c77e73.tar.xz |
(svn r21521) -Codechange: Unify some cached values that were present in both road vehicles and trains.
Diffstat (limited to 'src/articulated_vehicles.cpp')
-rw-r--r-- | src/articulated_vehicles.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp index 7556d5497..8a67b2a9a 100644 --- a/src/articulated_vehicles.cpp +++ b/src/articulated_vehicles.cpp @@ -313,6 +313,9 @@ void AddArticulatedParts(Vehicle *first) * and we run out of available vehicles, bail out. */ if (!Vehicle::CanAllocateItem()) return; + GroundVehicleCache *gcache = v->GetGroundVehicleCache(); + gcache->first_engine = v->engine_type; // Needs to be set before first callback + const Engine *e_artic = Engine::Get(engine_type); switch (type) { default: NOT_REACHED(); @@ -326,7 +329,6 @@ void AddArticulatedParts(Vehicle *first) t->subtype = 0; t->track = front->track; t->railtype = front->railtype; - t->tcache.first_engine = front->engine_type; // needs to be set before first callback t->spritenum = e_artic->u.rail.image_index; if (e_artic->CanCarryCargo()) { @@ -348,8 +350,7 @@ void AddArticulatedParts(Vehicle *first) v = rv; rv->subtype = 0; - rv->rcache.first_engine = front->engine_type; // needs to be set before first callback - rv->rcache.cached_veh_length = 8; // Callback is called when the consist is finished + gcache->cached_veh_length = 8; // Callback is called when the consist is finished rv->state = RVSB_IN_DEPOT; rv->roadtype = front->roadtype; |