summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-08-09 20:44:23 +0000
committerpeter1138 <peter1138@openttd.org>2006-08-09 20:44:23 +0000
commit53d2650d9b7796e8dcad94fd4270f9a834ad0f8d (patch)
treec274fcdee8928c83b8e229e4092e1b138de31bf4 /train_cmd.c
parent83290e8ceac10f3c57e6698b1623cbc98f1e7e8e (diff)
downloadopenttd-53d2650d9b7796e8dcad94fd4270f9a834ad0f8d.tar.xz
(svn r5819) - NewGRF: add support for refit costs specified in NewGRF. This may affect the default refit costs for the default rail vehicles.
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 9fd87146c..1bcc1bffa 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1794,7 +1794,12 @@ int32 CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
};
if (amount != 0) {
- if (new_cid != v->cargo_type) cost += _price.build_railvehicle >> 8;
+ if (new_cid != v->cargo_type) {
+ int32 base_cost = (rvi->flags & RVI_WAGON) ?
+ _price.build_railwagon : _price.build_railvehicle;
+ cost += (EngInfo(v->engine_type)->refit_cost * base_cost) >> 9;
+ }
+
num += amount;
if (flags & DC_EXEC) {
v->cargo_count = (v->cargo_type == new_cid) ? min(amount, v->cargo_count) : 0;