From 62f3aa89f2899e0f928d2f71a37c1665156b3cd9 Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 7 Jan 2009 17:50:20 +0000 Subject: (svn r14903) -Fix: First create all articulated parts of roadvehicles, then call callback 36 capacity, also call it for all articulated parts. --- src/articulated_vehicles.cpp | 4 ++-- src/roadveh_cmd.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp index f959da77e..9f2e05bc0 100644 --- a/src/articulated_vehicles.cpp +++ b/src/articulated_vehicles.cpp @@ -277,7 +277,7 @@ void AddArticulatedParts(Vehicle **vl, VehicleType type) u->spritenum = rvi_artic->image_index; u->cargo_type = rvi_artic->cargo_type; - u->cargo_cap = rvi_artic->capacity; + u->cargo_cap = rvi_artic->capacity; // Callback 36 is called when the consist is finished SetArticulatedPart(u); } break; @@ -296,7 +296,7 @@ void AddArticulatedParts(Vehicle **vl, VehicleType type) u->spritenum = rvi_artic->image_index; u->cargo_type = rvi_artic->cargo_type; - u->cargo_cap = rvi_artic->capacity; + u->cargo_cap = rvi_artic->capacity; // Callback 36 is called when the consist is finished SetRoadVehArticPart(u); } break; diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index b0d5407e0..e36ec61e8 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -274,10 +274,15 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, v->vehicle_flags = 0; if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE); - v->cargo_cap = GetVehicleProperty(v, 0x0F, rvi->capacity); + v->cargo_cap = rvi->capacity; AddArticulatedParts(vl, VEH_ROAD); + /* Call callback 36s after the whole consist has been constructed */ + for (Vehicle *u = v; u != NULL; u = u->Next()) { + u->cargo_cap = GetVehicleProperty(u, 0x0F, u->cargo_cap); + } + VehiclePositionChanged(v); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); -- cgit v1.2.3-70-g09d2