File diff r20077:1122c5c64e88 → r20078:a7a34cf316df
src/economy.cpp
Show inline comments
 
@@ -1441,7 +1441,6 @@ static void LoadUnloadVehicle(Vehicle *f
 
				(v->type != VEH_AIRCRAFT || (Aircraft::From(v)->IsNormalAircraft() && v->Next()->cargo.Count() == 0))) {
 
			Vehicle *v_start = v->GetFirstEnginePart();
 
			CargoID new_cid = front->current_order.GetRefitCargo();
 
			byte new_subtype = front->current_order.GetRefitSubtype();
 

	
 
			/* Remove old capacity from consist capacity */
 
			consist_capleft[v_start->cargo_type] -= v_start->cargo_cap;
 
@@ -1471,8 +1470,7 @@ static void LoadUnloadVehicle(Vehicle *f
 
					if ((int)st->goods[cid].cargo.Count() > (int)consist_capleft[cid] + amount) {
 
						/* Try to find out if auto-refitting would succeed. In case the refit is allowed,
 
						 * the returned refit capacity will be greater than zero. */
 
						new_subtype = GetBestFittingSubType(v, v, cid);
 
						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.
 
						DoCommand(v_start->tile, v_start->index, cid | 1U << 6 | 0xFF << 8 | 1U << 16, DC_QUERY_COST, GetCmdRefitVeh(v_start)); // Auto-refit and only this vehicle including artic parts.
 
						if (_returned_refit_capacity > 0) {
 
							amount = st->goods[cid].cargo.Count() - consist_capleft[cid];
 
							new_cid = cid;
 
@@ -1483,7 +1481,7 @@ static void LoadUnloadVehicle(Vehicle *f
 

	
 
			/* Refit if given a valid cargo. */
 
			if (new_cid < NUM_CARGO) {
 
				CommandCost cost = 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.
 
				CommandCost cost = DoCommand(v_start->tile, v_start->index, new_cid | 1U << 6 | 0xFF << 8 | 1U << 16, DC_EXEC, GetCmdRefitVeh(v_start)); // Auto-refit and only this vehicle including artic parts.
 
				if (cost.Succeeded()) front->profit_this_year -= cost.GetCost() << 8;
 
				ge = &st->goods[v->cargo_type];
 
			}