(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)
This commit is contained in:
smatz
2011-02-08 18:27:21 +00:00
parent 7af2470a78
commit b4273bcd35
4 changed files with 16 additions and 3 deletions

View File

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