Changeset - r13026:0c3f00ec0a74
[Not reviewed]
master
0 25 0
rubidium - 15 years ago 2009-09-14 12:22:57
rubidium@openttd.org
(svn r17534) -Codechange: unify the naming of callback masks/flags
25 files changed with 86 insertions and 79 deletions:
0 comments (0 inline, 0 general)
src/aircraft_cmd.cpp
Show inline comments
 
@@ -387,7 +387,7 @@ CommandCost CmdBuildAircraft(TileIndex t
 
		if (v->cargo_type != CT_PASSENGERS) {
 
			uint16 callback = CALLBACK_FAILED;
 

	
 
			if (HasBit(EngInfo(p1)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
			if (HasBit(EngInfo(p1)->callback_mask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
				callback = GetVehicleCallback(CBID_VEHICLE_REFIT_CAPACITY, 0, 0, v->engine_type, v);
 
			}
 

	
 
@@ -537,7 +537,7 @@ CommandCost CmdRefitAircraft(TileIndex t
 

	
 
	/* Check the refit capacity callback */
 
	uint16 callback = CALLBACK_FAILED;
 
	if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
	if (HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
		/* Back up the existing cargo type */
 
		CargoID temp_cid = v->cargo_type;
 
		byte temp_subtype = v->cargo_subtype;
src/articulated_vehicles.cpp
Show inline comments
 
@@ -22,7 +22,7 @@ static const uint MAX_ARTICULATED_PARTS 
 

	
 
uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
 
{
 
	if (!HasBit(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return 0;
 
	if (!HasBit(EngInfo(engine_type)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return 0;
 

	
 
	/* If we can't allocate a vehicle now, we can't allocate it in the command
 
	 * either, so it doesn't matter how many articulated parts there are. */
 
@@ -95,7 +95,7 @@ CargoArray GetCapacityOfArticulatedParts
 

	
 
	if (type != VEH_TRAIN && type != VEH_ROAD) return capacity;
 

	
 
	if (!HasBit(EngInfo(engine)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
 
	if (!HasBit(EngInfo(engine)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
 

	
 
	for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
 
@@ -122,7 +122,7 @@ bool IsArticulatedVehicleRefittable(Engi
 
	const Engine *e = Engine::Get(engine);
 
	if (e->type != VEH_TRAIN && e->type != VEH_ROAD) return false;
 

	
 
	if (!HasBit(e->info.callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return false;
 
	if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return false;
 

	
 
	for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
 
@@ -148,7 +148,7 @@ uint32 GetUnionOfArticulatedRefitMasks(E
 

	
 
	if (type != VEH_TRAIN && type != VEH_ROAD) return cargos;
 

	
 
	if (!HasBit(EngInfo(engine)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return cargos;
 
	if (!HasBit(EngInfo(engine)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return cargos;
 

	
 
	for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
 
@@ -177,7 +177,7 @@ uint32 GetIntersectionOfArticulatedRefit
 

	
 
	if (type != VEH_TRAIN && type != VEH_ROAD) return cargos;
 

	
 
	if (!HasBit(EngInfo(engine)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return cargos;
 
	if (!HasBit(EngInfo(engine)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return cargos;
 

	
 
	for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
 
@@ -291,7 +291,7 @@ void CheckConsistencyOfArticulatedVehicl
 

	
 
void AddArticulatedParts(Vehicle *first, VehicleType type)
 
{
 
	if (!HasBit(EngInfo(first->engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return;
 
	if (!HasBit(EngInfo(first->engine_type)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return;
 

	
 
	Vehicle *v = first;
 
	for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
src/cargotype.h
Show inline comments
 
@@ -44,7 +44,7 @@ struct CargoSpec {
 
	bool is_freight;
 
	TownEffect town_effect; ///< The effect this cargo type has on towns
 
	uint16 multipliertowngrowth;
 
	uint8 callback_mask;
 
	uint8 callback_mask;         ///< Bitmask of cargo callbacks that have to be called
 

	
 
	StringID name;
 
	StringID name_single;
src/economy.cpp
Show inline comments
 
@@ -883,7 +883,7 @@ static uint DeliverGoodsToIndustry(const
 
		if (cargo_index >= lengthof(ind->accepts_cargo)) continue;
 

	
 
		/* Check if industry temporarily refuses acceptance */
 
		if (HasBit(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
 
		if (HasBit(indspec->callback_mask, CBM_IND_REFUSE_CARGO)) {
 
			uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO, 0, GetReverseCargoTranslation(cargo_type, indspec->grf_prop.grffile), ind, ind->type, ind->xy);
 
			if (res == 0) continue;
 
		}
 
@@ -957,7 +957,7 @@ static Money DeliverGoods(int num_pieces
 
static void TriggerIndustryProduction(Industry *i)
 
{
 
	const IndustrySpec *indspec = GetIndustrySpec(i->type);
 
	uint16 callback = indspec->callback_flags;
 
	uint16 callback = indspec->callback_mask;
 

	
 
	i->was_cargo_delivered = true;
 
	i->last_cargo_accepted_at = _date;
 
@@ -1144,7 +1144,7 @@ static void LoadUnloadVehicle(Vehicle *v
 
		/* The default loadamount for mail is 1/4 of the load amount for passengers */
 
		if (v->type == VEH_AIRCRAFT && !Aircraft::From(v)->IsNormalAircraft()) load_amount = (load_amount + 3) / 4;
 

	
 
		if (_settings_game.order.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) {
 
		if (_settings_game.order.gradual_loading && HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_LOAD_AMOUNT)) {
 
			uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
 
			if (cb_load_amount != CALLBACK_FAILED && GB(cb_load_amount, 0, 8) != 0) load_amount = GB(cb_load_amount, 0, 8);
 
		}
src/engine.cpp
Show inline comments
 
@@ -793,7 +793,7 @@ bool IsEngineRefittable(EngineID engine)
 

	
 
	/* Are there suffixes?
 
	 * Note: This does not mean the suffixes are actually available for every consist at any time. */
 
	if (HasBit(ei->callbackmask, CBM_VEHICLE_CARGO_SUFFIX)) return true;
 
	if (HasBit(ei->callback_mask, CBM_VEHICLE_CARGO_SUFFIX)) return true;
 

	
 
	/* Is there any cargo except the default cargo? */
 
	CargoID default_cargo = e->GetDefaultCargoType();
src/engine_type.h
Show inline comments
 
@@ -119,7 +119,7 @@ struct EngineInfo {
 
	uint32 refit_mask;
 
	byte refit_cost;
 
	byte misc_flags;
 
	byte callbackmask;
 
	byte callback_mask; ///< Bitmask of vehicle callbacks that have to be called
 
	int8 retire_early;  ///< Number of years early to retire vehicle
 
	StringID string_id; ///< Default name of engine
 
};
src/house.h
Show inline comments
 
@@ -109,7 +109,7 @@ struct HouseSpec {
 
	HouseID substitute_id;             ///< which original house this one is based on
 
	struct SpriteGroup *spritegroup;   ///< pointer to the different sprites of the house
 
	HouseID override;                  ///< which house this one replaces
 
	uint16 callback_mask;              ///< House callback flags
 
	uint16 callback_mask;              ///< Bitmask of house callbacks that have to be called
 
	byte random_colour[4];             ///< 4 "random" colours
 
	byte probability;                  ///< Relative probability of appearing (16 is the standard value)
 
	HouseExtraFlags extra_flags;       ///< some more flags
src/industry_cmd.cpp
Show inline comments
 
@@ -392,7 +392,7 @@ static Foundation GetFoundation_Industry
 
	 */
 
	if (gfx >= NEW_INDUSTRYTILEOFFSET) {
 
		const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
 
		if (indts->grf_prop.spritegroup != NULL && HasBit(indts->callback_flags, CBM_INDT_DRAW_FOUNDATIONS)) {
 
		if (indts->grf_prop.spritegroup != NULL && HasBit(indts->callback_mask, CBM_INDT_DRAW_FOUNDATIONS)) {
 
			uint32 callback_res = GetIndustryTileCallback(CBID_INDUSTRY_DRAW_FOUNDATIONS, 0, 0, gfx, Industry::GetByTile(tile), tile);
 
			if (callback_res == 0) return FOUNDATION_NONE;
 
		}
 
@@ -413,7 +413,7 @@ static void AddAcceptedCargo_Industry(Ti
 
	const CargoID *accepts_cargo = itspec->accepts_cargo;
 
	const uint8 *cargo_acceptance = itspec->acceptance;
 

	
 
	if (HasBit(itspec->callback_flags, CBM_INDT_ACCEPT_CARGO)) {
 
	if (HasBit(itspec->callback_mask, CBM_INDT_ACCEPT_CARGO)) {
 
		uint16 res = GetIndustryTileCallback(CBID_INDTILE_ACCEPT_CARGO, 0, 0, gfx, Industry::GetByTile(tile), tile);
 
		if (res != CALLBACK_FAILED) {
 
			accepts_cargo = raw_accepts_cargo;
 
@@ -421,7 +421,7 @@ static void AddAcceptedCargo_Industry(Ti
 
		}
 
	}
 

	
 
	if (HasBit(itspec->callback_flags, CBM_INDT_CARGO_ACCEPTANCE)) {
 
	if (HasBit(itspec->callback_mask, CBM_INDT_CARGO_ACCEPTANCE)) {
 
		uint16 res = GetIndustryTileCallback(CBID_INDTILE_CARGO_ACCEPTANCE, 0, 0, gfx, Industry::GetByTile(tile), tile);
 
		if (res != CALLBACK_FAILED) {
 
			cargo_acceptance = raw_cargo_acceptance;
 
@@ -1083,7 +1083,7 @@ static void ProduceIndustryGoods(Industr
 

	
 
	/* produce some cargo */
 
	if ((i->counter & 0xFF) == 0) {
 
		if (HasBit(indsp->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) IndustryProductionCallback(i, 1);
 
		if (HasBit(indsp->callback_mask, CBM_IND_PRODUCTION_256_TICKS)) IndustryProductionCallback(i, 1);
 

	
 
		IndustryBehaviour indbehav = indsp->behaviour;
 
		i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + i->production_rate[0]);
 
@@ -1091,7 +1091,7 @@ static void ProduceIndustryGoods(Industr
 

	
 
		if ((indbehav & INDUSTRYBEH_PLANT_FIELDS) != 0) {
 
			bool plant;
 
			if (HasBit(indsp->callback_flags, CBM_IND_SPECIAL_EFFECT)) {
 
			if (HasBit(indsp->callback_mask, CBM_IND_SPECIAL_EFFECT)) {
 
				plant = (GetIndustryCallback(CBID_INDUSTRY_SPECIAL_EFFECT, Random(), 0, i, i->type, i->xy) != 0);
 
			} else {
 
				plant = Chance16(1, 8);
 
@@ -1101,7 +1101,7 @@ static void ProduceIndustryGoods(Industr
 
		}
 
		if ((indbehav & INDUSTRYBEH_CUT_TREES) != 0) {
 
			bool cut = ((i->counter & 0x1FF) == 0);
 
			if (HasBit(indsp->callback_flags, CBM_IND_SPECIAL_EFFECT)) {
 
			if (HasBit(indsp->callback_mask, CBM_IND_SPECIAL_EFFECT)) {
 
				cut = (GetIndustryCallback(CBID_INDUSTRY_SPECIAL_EFFECT, 0, 1, i, i->type, i->xy) != 0);
 
			}
 

	
 
@@ -1300,7 +1300,7 @@ static bool CheckIfIndustryTilesAreFree(
 
			/* Perform land/water check if not disabled */
 
			if (!HasBit(its->slopes_refused, 5) && (IsWaterTile(cur_tile) == !(ind_behav & INDUSTRYBEH_BUILT_ONWATER))) return false;
 

	
 
			if (HasBit(its->callback_flags, CBM_INDT_SHAPE_CHECK)) {
 
			if (HasBit(its->callback_mask, CBM_INDT_SHAPE_CHECK)) {
 
				custom_shape = true;
 
				if (!PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index)) return false;
 
			} else {
 
@@ -1530,8 +1530,8 @@ static void DoCreateNewIndustry(Industry
 

	
 
	/* don't use smooth economy for industries using production related callbacks */
 
	if (_settings_game.economy.smooth_economy &&
 
	    !(HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 
	    !(HasBit(indspec->callback_flags, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CHANGE))             // production change callbacks
 
	    !(HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 
	    !(HasBit(indspec->callback_mask, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_CHANGE))             // production change callbacks
 
	) {
 
		i->production_rate[0] = min((RandomRange(256) + 128) * i->production_rate[0] >> 8 , 255);
 
		i->production_rate[1] = min((RandomRange(256) + 128) * i->production_rate[1] >> 8 , 255);
 
@@ -1563,12 +1563,12 @@ static void DoCreateNewIndustry(Industry
 
	i->last_month_production[1] = i->production_rate[1] * 8;
 
	i->founder = founder;
 

	
 
	if (HasBit(indspec->callback_flags, CBM_IND_DECIDE_COLOUR)) {
 
	if (HasBit(indspec->callback_mask, CBM_IND_DECIDE_COLOUR)) {
 
		uint16 res = GetIndustryCallback(CBID_INDUSTRY_DECIDE_COLOUR, 0, 0, i, type, INVALID_TILE);
 
		if (res != CALLBACK_FAILED) i->random_colour = GB(res, 0, 4);
 
	}
 

	
 
	if (HasBit(indspec->callback_flags, CBM_IND_INPUT_CARGO_TYPES)) {
 
	if (HasBit(indspec->callback_mask, CBM_IND_INPUT_CARGO_TYPES)) {
 
		for (j = 0; j < lengthof(i->accepts_cargo); j++) i->accepts_cargo[j] = CT_INVALID;
 
		for (j = 0; j < lengthof(i->accepts_cargo); j++) {
 
			uint16 res = GetIndustryCallback(CBID_INDUSTRY_INPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
 
@@ -1577,7 +1577,7 @@ static void DoCreateNewIndustry(Industry
 
		}
 
	}
 

	
 
	if (HasBit(indspec->callback_flags, CBM_IND_OUTPUT_CARGO_TYPES)) {
 
	if (HasBit(indspec->callback_mask, CBM_IND_OUTPUT_CARGO_TYPES)) {
 
		for (j = 0; j < lengthof(i->produced_cargo); j++) i->produced_cargo[j] = CT_INVALID;
 
		for (j = 0; j < lengthof(i->produced_cargo); j++) {
 
			uint16 res = GetIndustryCallback(CBID_INDUSTRY_OUTPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
 
@@ -1656,7 +1656,7 @@ static Industry *CreateNewIndustryHelper
 

	
 
	if (!CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, &custom_shape_check)) return NULL;
 

	
 
	if (HasBit(GetIndustrySpec(type)->callback_flags, CBM_IND_LOCATION)) {
 
	if (HasBit(GetIndustrySpec(type)->callback_mask, CBM_IND_LOCATION)) {
 
		if (!CheckIfCallBackAllowsCreation(tile, type, itspec_index, seed)) return NULL;
 
	} else {
 
		if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
 
@@ -2000,7 +2000,7 @@ static void CanCargoServiceIndustry(Carg
 
	for (byte j = 0; j < lengthof(ind->accepts_cargo); j++) {
 
		if (ind->accepts_cargo[j] == CT_INVALID) continue;
 
		if (cargo == ind->accepts_cargo[j]) {
 
			if (HasBit(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
 
			if (HasBit(indspec->callback_mask, CBM_IND_REFUSE_CARGO)) {
 
				uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO,
 
						0, GetReverseCargoTranslation(cargo, indspec->grf_prop.grffile),
 
						ind, ind->type, ind->xy);
 
@@ -2132,13 +2132,13 @@ static void ChangeIndustryProduction(Ind
 
	bool recalculate_multipliers = false; ///< reinitialize production_rate to match prod_level
 
	/* don't use smooth economy for industries using production related callbacks */
 
	bool smooth_economy = _settings_game.economy.smooth_economy &&
 
	                      !(HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 
	                      !(HasBit(indspec->callback_flags, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CHANGE));            // production change callbacks
 
	                      !(HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 
	                      !(HasBit(indspec->callback_mask, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_CHANGE));            // production change callbacks
 
	byte div = 0;
 
	byte mul = 0;
 
	int8 increment = 0;
 

	
 
	bool callback_enabled = HasBit(indspec->callback_flags, monthly ? CBM_IND_MONTHLYPROD_CHANGE : CBM_IND_PRODUCTION_CHANGE);
 
	bool callback_enabled = HasBit(indspec->callback_mask, monthly ? CBM_IND_MONTHLYPROD_CHANGE : CBM_IND_PRODUCTION_CHANGE);
 
	if (callback_enabled) {
 
		uint16 res = GetIndustryCallback(monthly ? CBID_INDUSTRY_MONTHLYPROD_CHANGE : CBID_INDUSTRY_PRODUCTION_CHANGE, 0, Random(), i, i->type, i->xy);
 
		if (res != CALLBACK_FAILED) { // failed callback means "do nothing"
 
@@ -2427,7 +2427,7 @@ static CommandCost TerraformTile_Industr
 
			const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
 

	
 
			/* Call callback 3C 'disable autosloping for industry tiles'. */
 
			if (HasBit(itspec->callback_flags, CBM_INDT_AUTOSLOPE)) {
 
			if (HasBit(itspec->callback_mask, CBM_INDT_AUTOSLOPE)) {
 
				/* If the callback fails, allow autoslope. */
 
				uint16 res = GetIndustryTileCallback(CBID_INDUSTRY_AUTOSLOPE, 0, 0, gfx, Industry::GetByTile(tile), tile);
 
				if ((res == 0) || (res == CALLBACK_FAILED)) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
src/industry_gui.cpp
Show inline comments
 
@@ -62,7 +62,7 @@ enum CargoSuffixType {
 
 */
 
static StringID GetCargoSuffix(uint cargo, CargoSuffixType cst, Industry *ind, IndustryType ind_type, const IndustrySpec *indspec)
 
{
 
	if (HasBit(indspec->callback_flags, CBM_IND_CARGO_SUFFIX)) {
 
	if (HasBit(indspec->callback_mask, CBM_IND_CARGO_SUFFIX)) {
 
		uint16 callback = GetIndustryCallback(CBID_INDUSTRY_CARGO_SUFFIX, 0, (cst << 8) | cargo, ind, ind_type, (cst != CST_FUND) ? ind->xy : INVALID_TILE);
 
		if (GB(callback, 0, 8) != 0xFF) return GetGRFStringID(indspec->grf_prop.grffile->grfid, 0xD000 + callback);
 
	}
 
@@ -291,7 +291,7 @@ public:
 

	
 
		/* Get the additional purchase info text, if it has not already been */
 
		if (this->text[this->selected_index] == STR_NULL) {   // Have i been called already?
 
			if (HasBit(indsp->callback_flags, CBM_IND_FUND_MORE_TEXT)) {          // No. Can it be called?
 
			if (HasBit(indsp->callback_mask, CBM_IND_FUND_MORE_TEXT)) {          // No. Can it be called?
 
				uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_FUND_MORE_TEXT, 0, 0, NULL, this->selected_type, INVALID_TILE);
 
				if (callback_res != CALLBACK_FAILED) {  // Did it failed?
 
					StringID newtxt = GetGRFStringID(indsp->grf_prop.grffile->grfid, 0xD000 + callback_res);  // No. here's the new string
 
@@ -508,7 +508,7 @@ public:
 
		SetDParam(0, this->window_number);
 
		this->DrawWidgets();
 

	
 
		if (HasBit(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
 
		if (HasBit(ind->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_mask, CBM_IND_PRODUCTION_256_TICKS)) {
 
			for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
 
				if (i->accepts_cargo[j] == CT_INVALID) continue;
 
				has_accept = true;
 
@@ -566,7 +566,7 @@ public:
 
		}
 

	
 
		/* Get the extra message for the GUI */
 
		if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) {
 
		if (HasBit(ind->callback_mask, CBM_IND_WINDOW_MORE_TEXT)) {
 
			uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_WINDOW_MORE_TEXT, 0, 0, i, i->type, i->xy);
 
			if (callback_res != CALLBACK_FAILED) {
 
				StringID message = GetGRFStringID(ind->grf_prop.grffile->grfid, 0xD000 + callback_res);
src/industrytype.h
Show inline comments
 
@@ -126,7 +126,7 @@ struct IndustrySpec {
 
	uint8 number_of_sounds;               ///< Number of sounds available in the sounds array
 
	const uint8 *random_sounds;           ///< array of random sounds.
 
	/* Newgrf data */
 
	uint16 callback_flags;                ///< Flags telling which grf callback is set
 
	uint16 callback_mask;                 ///< Bitmask of industry callbacks that have to be called
 
	uint8 cleanup_flag;                   ///< flags indicating which data should be freed upon cleaning up
 
	bool enabled;                         ///< entity still avaible (by default true).newgrf can disable it, though
 
	struct GRFFileProps grf_prop;         ///< properties related the the grf file
 
@@ -164,7 +164,7 @@ struct IndustryTileSpec {
 
	bool anim_state;                      ///< When true, the tile has to be drawn using the animation
 
	                                      ///< state instead of the construction state
 
	/* Newgrf data */
 
	uint8 callback_flags;                 ///< Flags telling which grf callback is set
 
	uint8 callback_mask;                  ///< Bitmask of industry tile callbacks that have to be called
 
	uint16 animation_info;                ///< Information about the animation (is it looping, how many loops etc)
 
	uint8 animation_speed;                ///< The speed of the animation
 
	uint8 animation_triggers;             ///< When to start the animation
src/newgrf.cpp
Show inline comments
 
@@ -696,7 +696,7 @@ static ChangeInfoResult RailVehicleChang
 
				break;
 

	
 
			case 0x1E: // Callback
 
				ei->callbackmask = grf_load_byte(&buf);
 
				ei->callback_mask = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x1F: // Tractive effort coefficient
 
@@ -857,7 +857,7 @@ static ChangeInfoResult RoadVehicleChang
 
				break;
 

	
 
			case 0x17: // Callback mask
 
				ei->callbackmask = grf_load_byte(&buf);
 
				ei->callback_mask = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x18: // Tractive effort
 
@@ -971,7 +971,7 @@ static ChangeInfoResult ShipVehicleChang
 
				break;
 

	
 
			case 0x12: // Callback mask
 
				ei->callbackmask = grf_load_byte(&buf);
 
				ei->callback_mask = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x13: // Refit cost
 
@@ -1087,7 +1087,7 @@ static ChangeInfoResult AircraftVehicleC
 
				break;
 

	
 
			case 0x14: // Callback mask
 
				ei->callbackmask = grf_load_byte(&buf);
 
				ei->callback_mask = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x15: // Refit cost
 
@@ -1219,7 +1219,7 @@ static ChangeInfoResult StationChangeInf
 
			} break;
 

	
 
			case 0x0B: // Callback mask
 
				statspec->callbackmask = grf_load_byte(&buf);
 
				statspec->callback_mask = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x0C: // Disallowed number of platforms
 
@@ -1349,7 +1349,7 @@ static ChangeInfoResult CanalChangeInfo(
 

	
 
		switch (prop) {
 
			case 0x08:
 
				wf->callbackmask = grf_load_byte(&buf);
 
				wf->callback_mask = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x09:
 
@@ -1596,7 +1596,7 @@ static ChangeInfoResult TownHouseChangeI
 
				housespec->building_availability = (HouseZones)grf_load_word(&buf);
 
				break;
 

	
 
			case 0x14: // House callback flags
 
			case 0x14: // House callback mask
 
				housespec->callback_mask = grf_load_byte(&buf);
 
				break;
 

	
 
@@ -1640,7 +1640,7 @@ static ChangeInfoResult TownHouseChangeI
 
				housespec->class_id = AllocateHouseClassID(grf_load_byte(&buf), _cur_grffile->grfid);
 
				break;
 

	
 
			case 0x1D: // Callback flags 2
 
			case 0x1D: // Callback mask part 2
 
				housespec->callback_mask |= (grf_load_byte(&buf) << 8);
 
				break;
 

	
 
@@ -2164,8 +2164,8 @@ static ChangeInfoResult IndustrytilesCha
 
				tsp->slopes_refused = (Slope)grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x0E: // Callback flags
 
				tsp->callback_flags = grf_load_byte(&buf);
 
			case 0x0E: // Callback mask
 
				tsp->callback_mask = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x0F: // Animation information
 
@@ -2430,10 +2430,10 @@ static ChangeInfoResult IndustriesChange
 
				indsp->prospecting_chance = grf_load_dword(&buf);
 
				break;
 

	
 
			case 0x21:   // Callback flags
 
			case 0x22: { // Callback additional flags
 
			case 0x21:   // Callback mask
 
			case 0x22: { // Callback additional mask
 
				byte aflag = grf_load_byte(&buf);
 
				SB(indsp->callback_flags, (prop - 0x21) * 8, 8, aflag);
 
				SB(indsp->callback_mask, (prop - 0x21) * 8, 8, aflag);
 
			} break;
 

	
 
			case 0x23: // removal cost multiplier
src/newgrf_callbacks.h
Show inline comments
 
@@ -263,6 +263,13 @@ enum HouseCallbackMask {
 
};
 

	
 
/**
 
 * Callback masks for canals.
 
 */
 
enum CanalCallbackMask {
 
	CBM_CANAL_SPRITE_OFFSET       = 1, ///< Enable add sprite offset callback
 
};
 

	
 
/**
 
 * Callback masks for cargos.
 
 */
 
enum CargoCallbackMask {
src/newgrf_canal.h
Show inline comments
 
@@ -29,7 +29,7 @@ enum CanalFeature {
 
struct WaterFeature {
 
	const SpriteGroup *group;
 
	const GRFFile *grffile;   ///< newgrf where 'group' belongs to
 
	uint8 callbackmask;
 
	uint8 callback_mask;       ///< Bitmask of canal callbacks that have to be called
 
	uint8 flags;
 
};
 

	
src/newgrf_industries.cpp
Show inline comments
 
@@ -198,7 +198,7 @@ uint32 IndustryGetVariable(const Resolve
 
		case 0x40:
 
		case 0x41:
 
		case 0x42: { // waiting cargo, but only if those two callback flags are set
 
			uint16 callback = indspec->callback_flags;
 
			uint16 callback = indspec->callback_mask;
 
			if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(callback, CBM_IND_PRODUCTION_256_TICKS)) {
 
				if ((indspec->behaviour & INDUSTRYBEH_PROD_MULTI_HNDLING) != 0) {
 
					return min(industry->incoming_cargo_waiting[variable - 0x40] / industry->prod_level, (uint16)0xFFFF);
 
@@ -495,7 +495,7 @@ bool CheckIfCallBackAllowsAvailability(I
 
{
 
	const IndustrySpec *indspec = GetIndustrySpec(type);
 

	
 
	if (HasBit(indspec->callback_flags, CBM_IND_AVAILABLE)) {
 
	if (HasBit(indspec->callback_mask, CBM_IND_AVAILABLE)) {
 
		uint16 res = GetIndustryCallback(CBID_INDUSTRY_AVAILABLE, 0, creation_type, NULL, type, INVALID_TILE);
 
		if (res != CALLBACK_FAILED) {
 
			return (res == 0);
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -241,7 +241,7 @@ bool DrawNewIndustryTile(TileInfo *ti, I
 

	
 
	if (ti->tileh != SLOPE_FLAT) {
 
		bool draw_old_one = true;
 
		if (HasBit(inds->callback_flags, CBM_INDT_DRAW_FOUNDATIONS)) {
 
		if (HasBit(inds->callback_mask, CBM_INDT_DRAW_FOUNDATIONS)) {
 
			/* Called to determine the type (if any) of foundation to draw for industry tile */
 
			uint32 callback_res = GetIndustryTileCallback(CBID_INDUSTRY_DRAW_FOUNDATIONS, 0, 0, gfx, i, ti->tile);
 
			draw_old_one = callback_res != 0;
 
@@ -304,7 +304,7 @@ void AnimateNewIndustryTile(TileIndex ti
 
	const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
 
	byte animation_speed = itspec->animation_speed;
 

	
 
	if (HasBit(itspec->callback_flags, CBM_INDT_ANIM_SPEED)) {
 
	if (HasBit(itspec->callback_mask, CBM_INDT_ANIM_SPEED)) {
 
		uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_ANIMATION_SPEED, 0, 0, gfx, ind, tile);
 
		if (callback_res != CALLBACK_FAILED) animation_speed = Clamp(callback_res & 0xFF, 0, 16);
 
	}
 
@@ -319,7 +319,7 @@ void AnimateNewIndustryTile(TileIndex ti
 
	byte frame = GetIndustryAnimationState(tile);
 
	uint16 num_frames = GB(itspec->animation_info, 0, 8);
 

	
 
	if (HasBit(itspec->callback_flags, CBM_INDT_ANIM_NEXT_FRAME)) {
 
	if (HasBit(itspec->callback_mask, CBM_INDT_ANIM_NEXT_FRAME)) {
 
		uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_ANIM_NEXT_FRAME, HasBit(itspec->animation_special_flags, 0) ? Random() : 0, 0, gfx, ind, tile);
 

	
 
		if (callback_res != CALLBACK_FAILED) {
src/newgrf_sound.cpp
Show inline comments
 
@@ -62,7 +62,7 @@ bool PlayVehicleSound(const Vehicle *v, 
 
	if (file == NULL) return false;
 

	
 
	/* Check that the vehicle type uses the sound effect callback */
 
	if (!HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_SOUND_EFFECT)) return false;
 
	if (!HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_SOUND_EFFECT)) return false;
 

	
 
	callback = GetVehicleCallback(CBID_VEHICLE_SOUND_EFFECT, event, 0, v->engine_type, v);
 
	if (callback == CALLBACK_FAILED) return false;
src/newgrf_station.cpp
Show inline comments
 
@@ -878,7 +878,7 @@ bool DrawStationTile(int x, int y, RailT
 

	
 
	relocation = GetCustomStationRelocation(statspec, NULL, INVALID_TILE);
 

	
 
	if (HasBit(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
 
	if (HasBit(statspec->callback_mask, CBM_STATION_SPRITE_LAYOUT)) {
 
		uint16 callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0x2110000, 0, statspec, NULL, INVALID_TILE);
 
		if (callback != CALLBACK_FAILED) tile = callback;
 
	}
 
@@ -969,7 +969,7 @@ void AnimateStationTile(TileIndex tile)
 

	
 
	uint8 animation_speed = ss->anim_speed;
 

	
 
	if (HasBit(ss->callbackmask, CBM_STATION_ANIMATION_SPEED)) {
 
	if (HasBit(ss->callback_mask, CBM_STATION_ANIMATION_SPEED)) {
 
		uint16 callback = GetStationCallback(CBID_STATION_ANIMATION_SPEED, 0, 0, ss, st, tile);
 
		if (callback != CALLBACK_FAILED) animation_speed = Clamp(callback & 0xFF, 0, 16);
 
	}
 
@@ -981,7 +981,7 @@ void AnimateStationTile(TileIndex tile)
 

	
 
	bool frame_set_by_callback = false;
 

	
 
	if (HasBit(ss->callbackmask, CBM_STATION_ANIMATION_NEXT_FRAME)) {
 
	if (HasBit(ss->callback_mask, CBM_STATION_ANIMATION_NEXT_FRAME)) {
 
		uint32 param = HasBit(ss->flags, SSF_CB141_RANDOM_BITS) ? Random() : 0;
 
		uint16 callback = GetStationCallback(CBID_STATION_ANIM_NEXT_FRAME, param, 0, ss, st, tile);
 

	
src/newgrf_station.h
Show inline comments
 
@@ -83,7 +83,7 @@ struct StationSpec {
 

	
 
	uint32 cargo_triggers; ///< Bitmask of cargo types which cause trigger re-randomizing
 

	
 
	byte callbackmask; ///< Bitmask of callbacks to use, @see newgrf_callbacks.h
 
	byte callback_mask; ///< Bitmask of station callbacks that have to be called
 

	
 
	byte flags; ///< Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by station size
 

	
src/rail_gui.cpp
Show inline comments
 
@@ -1155,7 +1155,7 @@ public:
 

	
 
					StringID str = STR_STATION_CLASS_DFLT;
 
					if (statspec != NULL && statspec->name != 0) {
 
						if (HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) {
 
						if (HasBit(statspec->callback_mask, CBM_STATION_AVAIL) && GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) {
 
							GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, 0, FILLRECT_CHECKER);
 
						}
 
						str = statspec->name;
 
@@ -1315,7 +1315,7 @@ public:
 
				/* Check station availability callback */
 
				statspec = GetCustomStationSpec(_railstation.station_class, y);
 
				if (statspec != NULL &&
 
					HasBit(statspec->callbackmask, CBM_STATION_AVAIL) &&
 
					HasBit(statspec->callback_mask, CBM_STATION_AVAIL) &&
 
					GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) return;
 

	
 
				_railstation.station_type = y;
 
@@ -1795,7 +1795,7 @@ struct BuildRailWaypointWindow : PickerW
 
				DrawWaypointSprite(this->nested_array[BRWW_WAYPOINT_1 + i]->pos_x + TILE_PIXELS, bottom - TILE_PIXELS, this->hscroll.GetPosition() + i, _cur_railtype);
 

	
 
				if (statspec != NULL &&
 
						HasBit(statspec->callbackmask, CBM_STATION_AVAIL) &&
 
						HasBit(statspec->callback_mask, CBM_STATION_AVAIL) &&
 
						GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) {
 
					GfxFillRect(4 + i * 68, 18, 67 + i * 68, 75, 0, FILLRECT_CHECKER);
 
				}
 
@@ -1816,7 +1816,7 @@ struct BuildRailWaypointWindow : PickerW
 
				/* Check station availability callback */
 
				const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, type);
 
				if (statspec != NULL &&
 
						HasBit(statspec->callbackmask, CBM_STATION_AVAIL) &&
 
						HasBit(statspec->callback_mask, CBM_STATION_AVAIL) &&
 
						GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) return;
 

	
 
				_cur_waypoint_type = type;
src/roadveh_cmd.cpp
Show inline comments
 
@@ -2020,7 +2020,7 @@ CommandCost CmdRefitRoadVeh(TileIndex ti
 
		const Engine *e = Engine::Get(v->engine_type);
 
		if (!e->CanCarryCargo()) continue;
 

	
 
		if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
		if (HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
			/* Back up the cargo type */
 
			CargoID temp_cid = v->cargo_type;
 
			byte temp_subtype = v->cargo_subtype;
src/ship_cmd.cpp
Show inline comments
 
@@ -918,7 +918,7 @@ CommandCost CmdRefitShip(TileIndex tile,
 
	if (new_cid >= NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
 

	
 
	/* Check the refit capacity callback */
 
	if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
	if (HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
		/* Back up the existing cargo type */
 
		CargoID temp_cid = v->cargo_type;
 
		byte temp_subtype = v->cargo_subtype;
src/station_cmd.cpp
Show inline comments
 
@@ -1054,7 +1054,7 @@ CommandCost CmdBuildRailStation(TileInde
 
		}
 

	
 
		/* Check if the station is buildable */
 
		if (HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) {
 
		if (HasBit(statspec->callback_mask, CBM_STATION_AVAIL) && GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) {
 
			return CMD_ERROR;
 
		}
 
	}
 
@@ -2306,7 +2306,7 @@ static void DrawTile_Station(TileInfo *t
 

	
 
			relocation = GetCustomStationRelocation(statspec, st, ti->tile);
 

	
 
			if (HasBit(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
 
			if (HasBit(statspec->callback_mask, CBM_STATION_SPRITE_LAYOUT)) {
 
				uint16 callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0, 0, statspec, st, ti->tile);
 
				if (callback != CALLBACK_FAILED) tile = (callback & ~1) + GetRailStationAxis(ti->tile);
 
			}
src/train_cmd.cpp
Show inline comments
 
@@ -286,7 +286,7 @@ void TrainConsistChanged(Train *v, bool 
 
		}
 

	
 
		/* Check powered wagon / visual effect callback */
 
		if (HasBit(EngInfo(u->engine_type)->callbackmask, CBM_TRAIN_WAGON_POWER)) {
 
		if (HasBit(EngInfo(u->engine_type)->callback_mask, CBM_TRAIN_WAGON_POWER)) {
 
			uint16 callback = GetVehicleCallback(CBID_TRAIN_WAGON_POWER, 0, 0, u->engine_type, u);
 

	
 
			if (callback != CALLBACK_FAILED) u->tcache.cached_vis_effect = GB(callback, 0, 8);
 
@@ -328,7 +328,7 @@ void TrainConsistChanged(Train *v, bool 
 

	
 
		/* check the vehicle length (callback) */
 
		uint16 veh_len = CALLBACK_FAILED;
 
		if (HasBit(EngInfo(u->engine_type)->callbackmask, CBM_VEHICLE_LENGTH)) {
 
		if (HasBit(EngInfo(u->engine_type)->callback_mask, CBM_VEHICLE_LENGTH)) {
 
			veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, u->engine_type, u);
 
		}
 
		if (veh_len == CALLBACK_FAILED) veh_len = rvi_u->shorten_factor;
 
@@ -2006,7 +2006,7 @@ CommandCost CmdReverseTrainDirection(Til
 
	if (p2 != 0) {
 
		/* turn a single unit around */
 

	
 
		if (v->IsMultiheaded() || HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) {
 
		if (v->IsMultiheaded() || HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) {
 
			return_cmd_error(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE_MULTIPLE_UNITS);
 
		}
 

	
 
@@ -2104,7 +2104,7 @@ CommandCost CmdRefitRailVehicle(TileInde
 
		if (e->CanCarryCargo()) {
 
			uint16 amount = CALLBACK_FAILED;
 

	
 
			if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
			if (HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_REFIT_CAPACITY)) {
 
				/* Back up the vehicle's cargo type */
 
				CargoID temp_cid = v->cargo_type;
 
				byte temp_subtype = v->cargo_subtype;
src/vehicle.cpp
Show inline comments
 
@@ -1361,7 +1361,7 @@ static SpriteID GetEngineColourMap(Engin
 
	if (map != PAL_NONE) return map;
 

	
 
	/* Check if we should use the colour map callback */
 
	if (HasBit(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_COLOUR_REMAP)) {
 
	if (HasBit(EngInfo(engine_type)->callback_mask, CBM_VEHICLE_COLOUR_REMAP)) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_COLOUR_MAPPING, 0, 0, engine_type, v);
 
		/* A return value of 0xC000 is stated to "use the default two-colour
 
		 * maps" which happens to be the failure action too... */
src/vehicle_gui.cpp
Show inline comments
 
@@ -163,7 +163,7 @@ static RefitList *BuildRefitList(const V
 

	
 
	do {
 
		uint32 cmask = EngInfo(u->engine_type)->refit_mask;
 
		byte callbackmask = EngInfo(u->engine_type)->callbackmask;
 
		byte callback_mask = EngInfo(u->engine_type)->callback_mask;
 

	
 
		/* Skip this engine if it has no capacity */
 
		if (u->cargo_cap == 0) continue;
 
@@ -174,7 +174,7 @@ static RefitList *BuildRefitList(const V
 
			if (!HasBit(cmask, cid)) continue;
 

	
 
			/* Check the vehicle's callback mask for cargo suffixes */
 
			if (HasBit(callbackmask, CBM_VEHICLE_CARGO_SUFFIX)) {
 
			if (HasBit(callback_mask, CBM_VEHICLE_CARGO_SUFFIX)) {
 
				/* Make a note of the original cargo type. It has to be
 
				 * changed to test the cargo & subtype... */
 
				CargoID temp_cargo = u->cargo_type;
 
@@ -495,7 +495,7 @@ uint ShowRefitOptionsList(int left, int 
 
/** Get the cargo subtype text from NewGRF for the vehicle details window. */
 
StringID GetCargoSubtypeText(const Vehicle *v)
 
{
 
	if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_CARGO_SUFFIX)) {
 
	if (HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_CARGO_SUFFIX)) {
 
		uint16 cb = GetVehicleCallback(CBID_VEHICLE_CARGO_SUFFIX, 0, 0, v->engine_type, v);
 
		if (cb != CALLBACK_FAILED) {
 
			return GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + cb);
0 comments (0 inline, 0 general)