From 48b7916458de4b2cdbc226a4a6ab078db4c77e73 Mon Sep 17 00:00:00 2001 From: terkhen Date: Tue, 14 Dec 2010 21:33:53 +0000 Subject: (svn r21521) -Codechange: Unify some cached values that were present in both road vehicles and trains. --- src/articulated_vehicles.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/articulated_vehicles.cpp') 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; -- cgit v1.2.3-54-g00ecf