summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2011-11-04 13:21:24 +0000
committermichi_cc <michi_cc@openttd.org>2011-11-04 13:21:24 +0000
commit81f583de4775858ec78b66b4e9bea6ce9952c5b9 (patch)
treefd6aa032657b81ed9b449a3638aed3d0226ab1af
parent2a2c102b0b173d6ebcfb90291eb56e82c4e935a7 (diff)
downloadopenttd-81f583de4775858ec78b66b4e9bea6ce9952c5b9.tar.xz
(svn r23109) -Fix: Subtract auto-refit costs from the vehicle profit.
-rw-r--r--src/economy.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index ef1c64e5c..2480be14f 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1311,7 +1311,8 @@ static void LoadUnloadVehicle(Vehicle *front, int *cargo_left)
/* Refit if given a valid 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];
}