summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-06-04 17:49:16 +0000
committerpeter1138 <peter1138@openttd.org>2006-06-04 17:49:16 +0000
commit18b0ea5473fb0179f0969db91162cae65a21b5cb (patch)
treedc2b05bb9be51dab29333186522ff5a64b983479 /train_cmd.c
parent2802c4b9c6751d1a22869e244f73d657d1bf8db5 (diff)
downloadopenttd-18b0ea5473fb0179f0969db91162cae65a21b5cb.tar.xz
(svn r5104) - When refitting a vehicle to its existing cargo type, don't lose the cargo onboard (useful when adding wagons to a train)
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/train_cmd.c b/train_cmd.c
index a189a9d9a..ad0aa8965 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1789,7 +1789,7 @@ int32 CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (new_cid != v->cargo_type) cost += _price.build_railvehicle >> 8;
num += amount;
if (flags & DC_EXEC) {
- v->cargo_count = 0;
+ v->cargo_count = (v->cargo_type == new_cid) ? min(amount, v->cargo_count) : 0;
v->cargo_type = new_cid;
v->cargo_cap = amount;
v->cargo_subtype = new_subtype;