(svn r4659) - Backport from trunk (r4158): 0.4
authorDarkvater
Tue, 02 May 2006 12:17:16 +0000
branch0.4
changeset 9974 ba5c238b40e7
parent 9973 72d7f7f30746
child 9975 61857a49e8f7
(svn r4659) - Backport from trunk (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
vehicle.c
--- a/vehicle.c	Sat Apr 29 14:38:21 2006 +0000
+++ b/vehicle.c	Tue May 02 12:17:16 2006 +0000
@@ -1634,7 +1634,11 @@
 		/* 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;
 			}
 		}