(svn r25041) -Remove [FS#3764-ish]: ordered refit with subtypes, since the cases where it worked were corner cases rather than the general case.

This commit is contained in:
frosch
2013-02-24 16:41:51 +00:00
parent 205543f727
commit 22bb015f3d
7 changed files with 21 additions and 35 deletions

View File

@@ -1441,7 +1441,6 @@ static void LoadUnloadVehicle(Vehicle *front)
(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 *front)
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 *front)
/* 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];
}