Changeset - r26838:0003b17a708e
[Not reviewed]
master
0 3 0
Michael Lutz - 23 months ago 2023-01-22 17:56:36
michi@icosahedron.de
Add: [NewGRF] Second vehicle property for additional callback flags.
3 files changed with 25 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/engine_type.h
Show inline comments
 
@@ -150,10 +150,10 @@ struct EngineInfo {
 
	CargoID cargo_type;
 
	CargoTypes refit_mask;
 
	byte refit_cost;
 
	byte misc_flags;    ///< Miscellaneous flags. @see EngineMiscFlags
 
	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
 
	byte misc_flags;         ///< Miscellaneous flags. @see EngineMiscFlags
 
	uint16 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
 
	uint16 cargo_age_period; ///< Number of ticks before carried cargo is aged.
 
	EngineID variant_id;     ///< Engine variant ID. If set, will be treated specially in purchase lists.
 
	ExtraEngineFlags extra_flags;
src/newgrf.cpp
Show inline comments
 
@@ -1237,7 +1237,7 @@ static ChangeInfoResult RailVehicleChang
 
			}
 

	
 
			case 0x1E: // Callback
 
				ei->callback_mask = buf->ReadByte();
 
				SB(ei->callback_mask, 0, 8, buf->ReadByte());
 
				break;
 

	
 
			case PROP_TRAIN_TRACTIVE_EFFORT: // 0x1F Tractive effort coefficient
 
@@ -1336,6 +1336,10 @@ static ChangeInfoResult RailVehicleChang
 
				ei->extra_flags = static_cast<ExtraEngineFlags>(buf->ReadDWord());
 
				break;
 

	
 
			case 0x31: // Callback additional mask
 
				SB(ei->callback_mask, 8, 8, buf->ReadByte());
 
				break;
 

	
 
			default:
 
				ret = CommonVehicleChangeInfo(ei, prop, buf);
 
				break;
 
@@ -1454,7 +1458,7 @@ static ChangeInfoResult RoadVehicleChang
 
			}
 

	
 
			case 0x17: // Callback mask
 
				ei->callback_mask = buf->ReadByte();
 
				SB(ei->callback_mask, 0, 8, buf->ReadByte());
 
				break;
 

	
 
			case PROP_ROADVEH_TRACTIVE_EFFORT: // Tractive effort coefficient in 1/256.
 
@@ -1538,6 +1542,10 @@ static ChangeInfoResult RoadVehicleChang
 
				ei->extra_flags = static_cast<ExtraEngineFlags>(buf->ReadDWord());
 
				break;
 

	
 
			case 0x28: // Callback additional mask
 
				SB(ei->callback_mask, 8, 8, buf->ReadByte());
 
				break;
 

	
 
			default:
 
				ret = CommonVehicleChangeInfo(ei, prop, buf);
 
				break;
 
@@ -1638,7 +1646,7 @@ static ChangeInfoResult ShipVehicleChang
 
			}
 

	
 
			case 0x12: // Callback mask
 
				ei->callback_mask = buf->ReadByte();
 
				SB(ei->callback_mask, 0, 8, buf->ReadByte());
 
				break;
 

	
 
			case 0x13: // Refit cost
 
@@ -1718,6 +1726,10 @@ static ChangeInfoResult ShipVehicleChang
 
				ei->extra_flags = static_cast<ExtraEngineFlags>(buf->ReadDWord());
 
				break;
 

	
 
			case 0x22: // Callback additional mask
 
				SB(ei->callback_mask, 8, 8, buf->ReadByte());
 
				break;
 

	
 
			default:
 
				ret = CommonVehicleChangeInfo(ei, prop, buf);
 
				break;
 
@@ -1814,7 +1826,7 @@ static ChangeInfoResult AircraftVehicleC
 
			}
 

	
 
			case 0x14: // Callback mask
 
				ei->callback_mask = buf->ReadByte();
 
				SB(ei->callback_mask, 0, 8, buf->ReadByte());
 
				break;
 

	
 
			case 0x15: // Refit cost
 
@@ -1880,6 +1892,10 @@ static ChangeInfoResult AircraftVehicleC
 
				ei->extra_flags = static_cast<ExtraEngineFlags>(buf->ReadDWord());
 
				break;
 

	
 
			case 0x22: // Callback additional mask
 
				SB(ei->callback_mask, 8, 8, buf->ReadByte());
 
				break;
 

	
 
			default:
 
				ret = CommonVehicleChangeInfo(ei, prop, buf);
 
				break;
src/table/newgrf_debug_data.h
Show inline comments
 
@@ -42,6 +42,7 @@ static const NICallback _nic_vehicles[] 
 
	NICV(CBID_VEHICLE_SOUND_EFFECT,          CBM_VEHICLE_SOUND_EFFECT),
 
	NICV(CBID_VEHICLE_AUTOREPLACE_SELECTION, CBM_NO_BIT),
 
	NICV(CBID_VEHICLE_MODIFY_PROPERTY,       CBM_NO_BIT),
 
	NICV(CBID_VEHICLE_NAME,                  CBM_VEHICLE_NAME),
 
	NIC_END()
 
};
 

	
0 comments (0 inline, 0 general)