diff options
author | smatz <smatz@openttd.org> | 2008-09-03 10:30:07 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-09-03 10:30:07 +0000 |
commit | e25227d709147dec3c37f5f9316a478e3aa8db64 (patch) | |
tree | af95d7c098daba96203c5df403d03e580c0658e8 /src/cargopacket.cpp | |
parent | 882d39a08141aa819894efc6d5de81cd65a57a5e (diff) | |
download | openttd-e25227d709147dec3c37f5f9316a478e3aa8db64.tar.xz |
(svn r14234) -Fix: feeder share was computed wrong when splitting cargo packet
Diffstat (limited to 'src/cargopacket.cpp')
-rw-r--r-- | src/cargopacket.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index e50532376..44c3dfbbe 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -218,19 +218,21 @@ bool CargoList::MoveTo(CargoList *dest, uint count, CargoList::MoveToAction mta, /* Can move only part of the packet, so split it into two pieces */ if (mta != MTA_FINAL_DELIVERY) { CargoPacket *cp_new = new CargoPacket(); + + Money fs = cp->feeder_share * count / cp->count; + cp->feeder_share -= fs; + cp_new->source = cp->source; cp_new->source_xy = cp->source_xy; cp_new->loaded_at_xy = (mta == MTA_CARGO_LOAD) ? data : cp->loaded_at_xy; cp_new->days_in_transit = cp->days_in_transit; - cp_new->feeder_share = cp->feeder_share / count; + cp_new->feeder_share = fs; /* When cargo is moved into another vehicle you have *always* paid for it */ cp_new->paid_for = (mta == MTA_CARGO_LOAD) ? false : cp->paid_for; cp_new->count = count; dest->packets.push_back(cp_new); - - cp->feeder_share /= cp->count - count; } cp->count -= count; |