summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp4
-rw-r--r--src/articulated_vehicles.cpp12
-rw-r--r--src/cargotype.h2
-rw-r--r--src/economy.cpp6
-rw-r--r--src/engine.cpp2
-rw-r--r--src/engine_type.h2
-rw-r--r--src/house.h2
-rw-r--r--src/industry_cmd.cpp36
-rw-r--r--src/industry_gui.cpp8
-rw-r--r--src/industrytype.h4
-rw-r--r--src/newgrf.cpp26
-rw-r--r--src/newgrf_callbacks.h7
-rw-r--r--src/newgrf_canal.h2
-rw-r--r--src/newgrf_industries.cpp4
-rw-r--r--src/newgrf_industrytiles.cpp6
-rw-r--r--src/newgrf_sound.cpp2
-rw-r--r--src/newgrf_station.cpp6
-rw-r--r--src/newgrf_station.h2
-rw-r--r--src/rail_gui.cpp8
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/station_cmd.cpp4
-rw-r--r--src/train_cmd.cpp8
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/vehicle_gui.cpp6
25 files changed, 86 insertions, 79 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index fbd9de204..99faffa8e 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -387,7 +387,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
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 tile, DoCommandFlag flags, uint32 p1, uin
/* 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;
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp
index a36119906..f1ce4dc56 100644
--- a/src/articulated_vehicles.cpp
+++ b/src/articulated_vehicles.cpp
@@ -22,7 +22,7 @@ static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of 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(EngineID engine, VehicleType type)
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(EngineID engine)
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(EngineID engine, VehicleType type, bool i
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 GetIntersectionOfArticulatedRefitMasks(EngineID engine, VehicleType type,
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 CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
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++) {
diff --git a/src/cargotype.h b/src/cargotype.h
index a960b5764..61814dd6f 100644
--- a/src/cargotype.h
+++ b/src/cargotype.h
@@ -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;
diff --git a/src/economy.cpp b/src/economy.cpp
index 680727735..cca81413a 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -883,7 +883,7 @@ static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint n
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, CargoID cargo_type, StationID dest, Ti
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, int *cargo_left)
/* 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);
}
diff --git a/src/engine.cpp b/src/engine.cpp
index 09e0ad292..3430e48fb 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -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();
diff --git a/src/engine_type.h b/src/engine_type.h
index f5f99528a..cd903ff3f 100644
--- a/src/engine_type.h
+++ b/src/engine_type.h
@@ -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
};
diff --git a/src/house.h b/src/house.h
index 4d45df7f8..e6eae34c7 100644
--- a/src/house.h
+++ b/src/house.h
@@ -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
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 84a2609e1..24d8f280c 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -392,7 +392,7 @@ static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh)
*/
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(TileIndex tile, CargoArray &acceptance, ui
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(TileIndex tile, CargoArray &acceptance, ui
}
}
- 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(Industry *i)
/* 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(Industry *i)
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(Industry *i)
}
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(TileIndex tile, const IndustryTileTable
/* 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 *i, TileIndex tile, int type, const Ind
/* 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, TileIndex tile, int type, const Ind
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 *i, TileIndex tile, int type, const Ind
}
}
- 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(TileIndex tile, IndustryType type, DoCo
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(CargoID cargo, Industry *ind, bool *c_accept
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(Industry *i, bool monthly)
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_Industry(TileIndex tile, DoCommandFlag flags, u
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);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 53981ab48..7dd1c5a6f 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -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);
diff --git a/src/industrytype.h b/src/industrytype.h
index 68d95fab0..926bcd689 100644
--- a/src/industrytype.h
+++ b/src/industrytype.h
@@ -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
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 1e77d8a6e..6745f13e2 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -696,7 +696,7 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop
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 RoadVehicleChangeInfo(uint engine, int numinfo, int prop
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 ShipVehicleChangeInfo(uint engine, int numinfo, int prop
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 AircraftVehicleChangeInfo(uint engine, int numinfo, int
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 StationChangeInfo(uint stid, int numinfo, int prop, byte
} 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(uint id, int numinfo, int prop, byte **b
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 TownHouseChangeInfo(uint hid, int numinfo, int prop, byt
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 TownHouseChangeInfo(uint hid, int numinfo, int prop, byt
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 IndustrytilesChangeInfo(uint indtid, int numinfo, int pr
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 IndustriesChangeInfo(uint indid, int numinfo, int prop,
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
diff --git a/src/newgrf_callbacks.h b/src/newgrf_callbacks.h
index 5c693761d..30bdd2fc2 100644
--- a/src/newgrf_callbacks.h
+++ b/src/newgrf_callbacks.h
@@ -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 {
diff --git a/src/newgrf_canal.h b/src/newgrf_canal.h
index 20bda7408..8591fe26e 100644
--- a/src/newgrf_canal.h
+++ b/src/newgrf_canal.h
@@ -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;
};
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 25a4da20e..0af9aff62 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -198,7 +198,7 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par
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(IndustryType type, IndustryAvailabilityCa
{
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);
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index dd4737e3b..a8c125727 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -241,7 +241,7 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus
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 tile)
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 tile)
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) {
diff --git a/src/newgrf_sound.cpp b/src/newgrf_sound.cpp
index a3008b0f4..7b029554e 100644
--- a/src/newgrf_sound.cpp
+++ b/src/newgrf_sound.cpp
@@ -62,7 +62,7 @@ bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event)
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;
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 59bea3a6d..e3d1ff3d9 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -878,7 +878,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
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);
diff --git a/src/newgrf_station.h b/src/newgrf_station.h
index bbbd1c27c..b13b05d86 100644
--- a/src/newgrf_station.h
+++ b/src/newgrf_station.h
@@ -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
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 9574683bb..c1bbad7e7 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -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 : PickerWindowBase {
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 : PickerWindowBase {
/* 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;
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 2cf5fd8e7..14a968558 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -2020,7 +2020,7 @@ CommandCost CmdRefitRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
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;
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index a88d4f429..b612c6ec9 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -918,7 +918,7 @@ CommandCost CmdRefitShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
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;
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 0f8c3b3ba..f22f30e4f 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1054,7 +1054,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
}
/* 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 *ti)
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);
}
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index a74957bcc..0c4a0805e 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -286,7 +286,7 @@ void TrainConsistChanged(Train *v, bool same_length)
}
/* 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 same_length)
/* 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(TileIndex tile, DoCommandFlag flags, uint32
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(TileIndex tile, DoCommandFlag flags, uint32 p1,
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;
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 6a7cdebfd..b0a92fad7 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1361,7 +1361,7 @@ static SpriteID GetEngineColourMap(EngineID engine_type, CompanyID company, Engi
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... */
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index efb13681d..b25e02400 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -163,7 +163,7 @@ static RefitList *BuildRefitList(const Vehicle *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 Vehicle *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 right, int y, EngineID engine)
/** 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);