mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r17827) -Codechange: Deduplicate some lines of code.
This commit is contained in:
parent
8df61c0fc0
commit
ffb729ac9e
|
@ -278,19 +278,17 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
v->vehicle_flags = 0;
|
v->vehicle_flags = 0;
|
||||||
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
|
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
|
||||||
|
|
||||||
v->cargo_cap = rvi->capacity;
|
|
||||||
|
|
||||||
AddArticulatedParts(v);
|
AddArticulatedParts(v);
|
||||||
v->InvalidateNewGRFCacheOfChain();
|
v->InvalidateNewGRFCacheOfChain();
|
||||||
|
|
||||||
/* Call various callbacks after the whole consist has been constructed */
|
/* Call various callbacks after the whole consist has been constructed */
|
||||||
for (RoadVehicle *u = v; u != NULL; u = u->Next()) {
|
for (RoadVehicle *u = v; u != NULL; u = u->Next()) {
|
||||||
u->rcache.cached_veh_length = GetRoadVehLength(u);
|
|
||||||
/* Cargo capacity is zero if and only if the vehicle cannot carry anything */
|
/* Cargo capacity is zero if and only if the vehicle cannot carry anything */
|
||||||
if (u->cargo_cap != 0) u->cargo_cap = GetVehicleProperty(u, PROP_ROADVEH_CARGO_CAPACITY, u->cargo_cap);
|
if (u->cargo_cap != 0) u->cargo_cap = GetVehicleProperty(u, PROP_ROADVEH_CARGO_CAPACITY, u->cargo_cap);
|
||||||
v->InvalidateNewGRFCache();
|
v->InvalidateNewGRFCache();
|
||||||
u->InvalidateNewGRFCache();
|
u->InvalidateNewGRFCache();
|
||||||
}
|
}
|
||||||
|
RoadVehUpdateCache(v);
|
||||||
|
|
||||||
VehicleMove(v, false);
|
VehicleMove(v, false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue