summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-03-06 19:12:56 +0000
committermaedhros <maedhros@openttd.org>2007-03-06 19:12:56 +0000
commit60703d36918f807be207c4e5a17dd5fee90f13a2 (patch)
treea6eb067506dacac85c0391d2930cca3ad1bbeb70 /src
parentb5f418d9f13b2b7ba4a9d68faf7c703ea72dc24c (diff)
downloadopenttd-60703d36918f807be207c4e5a17dd5fee90f13a2.tar.xz
(svn r9029) -Fix (r7326): Only call the gradual loading amount callback if the bit for it is set in the vehicle's callbackmask.
Diffstat (limited to 'src')
-rw-r--r--src/economy.cpp2
-rw-r--r--src/newgrf_callbacks.h4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index b7eb0c65f..47246f7c5 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1368,7 +1368,7 @@ int LoadUnloadVehicle(Vehicle *v, bool just_arrived)
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;
}
diff --git a/src/newgrf_callbacks.h b/src/newgrf_callbacks.h
index edc2ea6bf..84c21f53d 100644
--- a/src/newgrf_callbacks.h
+++ b/src/newgrf_callbacks.h
@@ -19,8 +19,8 @@ enum CallbackID {
// 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