summaryrefslogtreecommitdiff
path: root/ship_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ship_cmd.c')
-rw-r--r--ship_cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ship_cmd.c b/ship_cmd.c
index 424d484fb..b193f954c 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -1061,7 +1061,7 @@ int32 CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
if (flags & DC_EXEC) {
- v->cargo_count = 0;
+ v->cargo_count = (v->cargo_type == new_cid) ? min(v->cargo_cap, v->cargo_count) : 0;
v->cargo_type = new_cid;
v->cargo_subtype = new_subtype;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);