diff --git a/engine.h b/engine.h index 1cd19a17d8..ccff6c47c4 100644 --- a/engine.h +++ b/engine.h @@ -40,6 +40,7 @@ typedef struct ShipVehicleInfo { byte running_cost; byte sfx; byte refittable; + byte callbackmask; } ShipVehicleInfo; typedef struct AircraftVehicleInfo { @@ -52,6 +53,7 @@ typedef struct AircraftVehicleInfo { byte max_speed; byte mail_capacity; uint16 passenger_capacity; + byte callbackmask; } AircraftVehicleInfo; typedef struct RoadVehicleInfo { @@ -62,6 +64,7 @@ typedef struct RoadVehicleInfo { byte max_speed; byte capacity; byte cargo_type; + byte callbackmask; } RoadVehicleInfo; /** Information about a vehicle diff --git a/newgrf.c b/newgrf.c index c8f2798d49..d8b0c386f2 100644 --- a/newgrf.c +++ b/newgrf.c @@ -555,6 +555,13 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf _engine_info[ROAD_ENGINES_INDEX + engine + i].refit_mask = refit_mask; } } break; + + case 0x17: // Callback mask + FOR_EACH_OBJECT { + rvi[i].callbackmask = grf_load_byte(&buf); + } + break; + case 0x1D: { /* Cargo classes allowed */ FOR_EACH_OBJECT { cargo_allowed[ROAD_ENGINES_INDEX + engine + i] = grf_load_word(&buf); @@ -565,7 +572,6 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf cargo_disallowed[ROAD_ENGINES_INDEX + engine + i] = grf_load_word(&buf); } } break; - case 0x17: /* Callback */ case 0x18: /* Tractive effort */ case 0x19: /* Air drag */ case 0x1A: /* Refit cost */ @@ -676,6 +682,13 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf _engine_info[SHIP_ENGINES_INDEX + engine + i].refit_mask = refit_mask; } } break; + + case 0x12: // Callback mask + FOR_EACH_OBJECT { + svi[i].callbackmask = grf_load_byte(&buf); + } + break; + case 0x18: { /* Cargo classes allowed */ FOR_EACH_OBJECT { cargo_allowed[SHIP_ENGINES_INDEX + engine + i] = grf_load_word(&buf); @@ -686,7 +699,6 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf cargo_disallowed[SHIP_ENGINES_INDEX + engine + i] = grf_load_word(&buf); } } break; - case 0x12: /* Callback */ case 0x13: /* Refit cost */ case 0x14: /* Ocean speed fraction */ case 0x15: /* Canal speed fraction */ @@ -799,6 +811,13 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte * _engine_info[AIRCRAFT_ENGINES_INDEX + engine + i].refit_mask = refit_mask; } } break; + + case 0x14: // Callback mask + FOR_EACH_OBJECT { + avi[i].callbackmask = grf_load_byte(&buf); + } + break; + case 0x18: { /* Cargo classes allowed */ FOR_EACH_OBJECT { cargo_allowed[AIRCRAFT_ENGINES_INDEX + engine + i] = grf_load_word(&buf); @@ -809,7 +828,6 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte * cargo_disallowed[AIRCRAFT_ENGINES_INDEX + engine + i] = grf_load_word(&buf); } } break; - case 0x14: /* Callback */ case 0x15: /* Refit cost */ case 0x16: /* Retire vehicle early */ case 0x17: /* Miscellaneous flags */ diff --git a/table/engines.h b/table/engines.h index 5a4f8b2a89..600bb0b9bf 100644 --- a/table/engines.h +++ b/table/engines.h @@ -467,7 +467,7 @@ const RailVehicleInfo orig_rail_vehicle_info[NUM_TRAIN_ENGINES] = { * @param g sound effect * @param h refittable */ -#define SVI(a, b, c, d, e, f, g, h) { a, b, c, d, e, f, g, h } +#define SVI(a, b, c, d, e, f, g, h) { a, b, c, d, e, f, g, h, 0 } const ShipVehicleInfo orig_ship_vehicle_info[NUM_SHIP_ENGINES] = { // image_index cargo_type cargo_amount refittable // | base_cost | | running_cost | @@ -499,7 +499,7 @@ const ShipVehicleInfo orig_ship_vehicle_info[NUM_SHIP_ENGINES] = { * @param h mail_capacity * @param i passenger_capacity */ -#define AVI(a, b, c, d, e, f, g, h, i) { a, b, c, d, e, f, g, h, i } +#define AVI(a, b, c, d, e, f, g, h, i) { a, b, c, d, e, f, g, h, i, 0 } #define H 0 #define P 1 #define J 3 @@ -566,7 +566,7 @@ const AircraftVehicleInfo orig_aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES] = { * @param f capacity * @param g cargo_type */ -#define RVI(a, b, c, d, e, f, g) { a, b, c, d, e, f, g } +#define RVI(a, b, c, d, e, f, g) { a, b, c, d, e, f, g, 0 } const RoadVehicleInfo orig_road_vehicle_info[NUM_ROAD_ENGINES] = { // image_index sfx max_speed // | base_cost | | capacity