Changeset - r6227:c374d167eb95
[Not reviewed]
master
0 2 0
maedhros - 17 years ago 2007-03-06 19:12:56
maedhros@openttd.org
(svn r9029) -Fix (r7326): Only call the gradual loading amount callback if the bit for it is set in the vehicle's callbackmask.
2 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/economy.cpp
Show inline comments
 
@@ -1365,13 +1365,13 @@ int LoadUnloadVehicle(Vehicle *v, bool j
 

	
 
	int all_vehicles_cargo_feeder_share = v->cargo_feeder_share; // used to hold transfer value of complete vehicle chain - used by trains
 

	
 
	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;
 
		}
 

	
 
		if (v->cargo_cap == 0) continue;
 

	
src/newgrf_callbacks.h
Show inline comments
 
@@ -16,14 +16,14 @@ enum CallbackID {
 
	CBID_TRAIN_WAGON_POWER          = 0x10,
 

	
 
	// Vehicle length, returns the amount of 1/8's the vehicle is shorter
 
	// 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
 
	 * newstation should be made available to build */
 
	CBID_STATION_AVAILABILITY       = 0x13,
 

	
0 comments (0 inline, 0 general)