changeset 18273:c7bd632d9cc2 draft

(svn r23109) -Fix: Subtract auto-refit costs from the vehicle profit.
author michi_cc <michi_cc@openttd.org>
date Fri, 04 Nov 2011 13:21:24 +0000
parents 3ebab55c5495
children c761b8c17062
files src/economy.cpp
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1311,7 +1311,8 @@
 
 			/* 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];
 			}