(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

@@ -1093,6 +1093,10 @@ void PrepareUnload(Vehicle *front_v)
}
assert(front_v->cargo_payment == NULL);
/* One CargoPayment per vehicle and the vehicle limit equals the
* limit in number of CargoPayments. Can't go wrong. */
assert_compile(CargoPaymentPool::MAX_SIZE == VehiclePool::MAX_SIZE);
assert(CargoPayment::CanAllocateItem());
front_v->cargo_payment = new CargoPayment(front_v);
}