summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-03-29 20:41:15 +0000
committerbjarni <bjarni@openttd.org>2006-03-29 20:41:15 +0000
commit0c64cecc662493c5beeff68b5e025212e0f97018 (patch)
treed9e3e8d6448e9488c61180f14dbcbc7de7b6db23 /vehicle.c
parent3633d5692327bc1cb86437fccdcdd906fa0ceb1b (diff)
downloadopenttd-0c64cecc662493c5beeff68b5e025212e0f97018.tar.xz
(svn r4158) -Fix: [autoreplace] cost for refitting the new vehicle is now added to the cost animation. The player always paid for it, but it was not displayed until now
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/vehicle.c b/vehicle.c
index 0183d04c7..35c0db24c 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1638,7 +1638,11 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags)
/* refit if needed */
if (new_v->type != VEH_Road) { // road vehicles can't be refitted
if (old_v->cargo_type != new_v->cargo_type && old_v->cargo_cap != 0 && new_v->cargo_cap != 0) {// some train engines do not have cargo capacity
- DoCommand(0, 0, new_v->index, old_v->cargo_type, DC_EXEC, CMD_REFIT_VEH(new_v->type));
+ // we add the refit cost to cost, so it's added to the cost animation
+ // it's not in the calculation of having enough money to actually do the replace since it's rather hard to do by design, but since
+ // we pay for it, it's nice to make the cost animation include it
+ int32 temp_cost = DoCommand(0, 0, new_v->index, old_v->cargo_type, DC_EXEC, CMD_REFIT_VEH(new_v->type));
+ if (!CmdFailed(temp_cost)) cost += temp_cost;
}
}