(svn r5104) - When refitting a vehicle to its existing cargo type, don't lose the cargo onboard (useful when adding wagons to a train)

This commit is contained in:
2006-06-04 17:49:16 +00:00
parent f00c3e7e25
commit 0a623bc333
3 changed files with 9 additions and 3 deletions

View File

@@ -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);