(svn r23109) -Fix: Subtract auto-refit costs from the vehicle profit.

This commit is contained in:
michi_cc
2011-11-04 13:21:24 +00:00
parent 0e2d2b2317
commit b80a3776d0

View File

@@ -1311,7 +1311,8 @@ static void LoadUnloadVehicle(Vehicle *front, int *cargo_left)
/* Refit if given a valid cargo. */ /* Refit if given a valid cargo. */
if (new_cid < NUM_CARGO) { if (new_cid < NUM_CARGO) {
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. CommandCost cost = 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.
if (cost.Succeeded()) front->profit_this_year -= cost.GetCost() << 8;
ge = &st->goods[v->cargo_type]; ge = &st->goods[v->cargo_type];
} }