(svn r9029) -Fix (r7326): Only call the gradual loading amount callback if the bit for it is set in the vehicle's callbackmask.
authormaedhros
Tue, 06 Mar 2007 19:12:56 +0000
changeset 6227 e38177bd77c4
parent 6226 e2e9607ea3cc
child 6228 a7b26082b00d
(svn r9029) -Fix (r7326): Only call the gradual loading amount callback if the bit for it is set in the vehicle's callbackmask.
src/economy.cpp
src/newgrf_callbacks.h
--- a/src/economy.cpp	Tue Mar 06 18:03:06 2007 +0000
+++ b/src/economy.cpp	Tue Mar 06 19:12:56 2007 +0000
@@ -1368,7 +1368,7 @@
 	for (; v != NULL; v = v->next) {
 		GoodsEntry* ge;
 		load_amount = EngInfo(v->engine_type)->load_amount;
-		if (_patches.gradual_loading) {
+		if (_patches.gradual_loading && HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_LOAD_AMOUNT)) {
 			uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
 			if (cb_load_amount != CALLBACK_FAILED) load_amount = cb_load_amount & 0xFF;
 		}
--- a/src/newgrf_callbacks.h	Tue Mar 06 18:03:06 2007 +0000
+++ b/src/newgrf_callbacks.h	Tue Mar 06 19:12:56 2007 +0000
@@ -19,8 +19,8 @@
 	// only for train vehicles
 	CBID_TRAIN_VEHICLE_LENGTH       = 0x11,
 
-	/* Called to determine the amount of cargo to load per unit of time when
-	 * using gradual loading. */
+	/* Called (if appropriate bit in callback mask is set) to determine the
+	 * amount of cargo to load per unit of time when using gradual loading. */
 	CBID_VEHICLE_LOAD_AMOUNT        = 0x12,
 
 	/* Called (if appropriate bit in callback mask is set) to determine if a