summaryrefslogtreecommitdiff
path: root/src/cargopacket.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-07-01 12:25:08 +0000
committerpeter1138 <peter1138@openttd.org>2007-07-01 12:25:08 +0000
commit7ce52ca8b7cd711bbe44a3de65ed092df36250bc (patch)
treedd4bcf92717430f044e12e0b1b79133ebfa61287 /src/cargopacket.cpp
parente5e4a5348fb1228183c86664b1977a487e33dfc8 (diff)
downloadopenttd-7ce52ca8b7cd711bbe44a3de65ed092df36250bc.tar.xz
(svn r10404) -Fix (r10266): Adding a cargo packet to cargo list could overflow. Now we detect this and just leave the cargo in its own packet.
Diffstat (limited to 'src/cargopacket.cpp')
-rw-r--r--src/cargopacket.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp
index 0de5b279d..b316b0297 100644
--- a/src/cargopacket.cpp
+++ b/src/cargopacket.cpp
@@ -228,7 +228,7 @@ void CargoList::Append(CargoPacket *cp)
assert(cp->IsValid());
for (List::iterator it = packets.begin(); it != packets.end(); it++) {
- if ((*it)->SameSource(cp)) {
+ if ((*it)->SameSource(cp) && (*it)->count + cp->count <= 65535) {
(*it)->count += cp->count;
(*it)->feeder_share += cp->feeder_share;
delete cp;