@ -1322,7 +1342,7 @@ static void LoadUnloadVehicle(Vehicle *front, int *cargo_left)
/* Check if all articulated parts are empty and collect refit mask. */
uint32refit_mask=e->info.refit_mask;
Vehicle*w=v;
Vehicle*w=v_start;
while(w->HasArticulatedPart()){
w=w->GetNextArticulatedPart();
if(w->cargo.Count()>0)new_cid=CT_NO_REFIT;
@ -1338,7 +1358,7 @@ static void LoadUnloadVehicle(Vehicle *front, int *cargo_left)
/* Try to find out if auto-refitting would succeed. In case the refit is allowed,
*thereturnedrefitcapacitywillbegreaterthanzero.*/
new_subtype=GetBestFittingSubType(v,v,cid);
DoCommand(v->tile,v->index,cid|1U<<6|new_subtype<<8|1U<<16,DC_QUERY_COST,GetCmdRefitVeh(v));// Auto-refit and only this vehicle including artic parts.
DoCommand(v_start->tile,v_start->index,cid|1U<<6|new_subtype<<8|1U<<16,DC_QUERY_COST,GetCmdRefitVeh(v_start));// Auto-refit and only this vehicle including artic parts.
if(_returned_refit_capacity>0){
amount=cargo_left[cid];
new_cid=cid;
@ -1349,7 +1369,7 @@ static void LoadUnloadVehicle(Vehicle *front, int *cargo_left)
/* Refit if given a valid cargo. */
if(new_cid<NUM_CARGO){
CommandCostcost=DoCommand(v->tile,v->index,new_cid|1U<<6|new_subtype<<8|1U<<16,DC_EXEC,GetCmdRefitVeh(v));// Auto-refit and only this vehicle including artic parts.
CommandCostcost=DoCommand(v_start->tile,v_start->index,new_cid|1U<<6|new_subtype<<8|1U<<16,DC_EXEC,GetCmdRefitVeh(v_start));// Auto-refit and only this vehicle including artic parts.