summaryrefslogtreecommitdiff
path: root/src/economy.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/economy.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/economy.cpp')
-rw-r--r--src/economy.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index c9e55653a..3d2a419ee 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -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);
}