summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-02-08 18:27:21 +0000
committersmatz <smatz@openttd.org>2011-02-08 18:27:21 +0000
commitb4273bcd35d4d0083dc9bd88a207283b4e3ba014 (patch)
tree80b6912d15868478bcd766083f738c8d197415fd /src/station_cmd.cpp
parent7af2470a78d73ac2953a6ed2eb36bca15c03d3e4 (diff)
downloadopenttd-b4273bcd35d4d0083dc9bd88a207283b4e3ba014.tar.xz
(svn r22023) -Fix: verify we can allocate a CargoPacket and CargoPayment before we actually try to do so
-Codechange: increase the limit of number of CargoPayments to match the limit of Vehicles (Rubidium)
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index d584b3131..5e72ded7f 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3165,6 +3165,10 @@ void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint rad
static uint UpdateStationWaiting(Station *st, CargoID type, uint amount, SourceType source_type, SourceID source_id)
{
+ /* We can't allocate a CargoPacket? Then don't do anything
+ * at all; i.e. just discard the incoming cargo. */
+ if (!CargoPacket::CanAllocateItem()) return 0;
+
GoodsEntry &ge = st->goods[type];
amount += ge.amount_fract;
ge.amount_fract = GB(amount, 0, 8);