Changeset - r15922:f33ae56b6561
[Not reviewed]
master
0 4 0
rubidium - 14 years ago 2010-08-26 11:18:32
rubidium@openttd.org
(svn r20620) -Codechange: rename airporttile's callback_flags to callback_mask, so it's the same for all NewGRF features with callbacks
4 files changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -3111,14 +3111,14 @@ static ChangeInfoResult AirportTilesChan
 
				}
 

	
 
				_airporttile_mngr.Add(airtid + i, _cur_grffile->grfid, override);
 
				break;
 
			}
 

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

	
 
			case 0x0F: // Animation information
 
				tsp->animation_info = buf->ReadWord();
 
				break;
 

	
src/newgrf_airporttiles.cpp
Show inline comments
 
@@ -279,13 +279,13 @@ bool DrawNewAirportTile(TileInfo *ti, St
 
{
 
	const SpriteGroup *group;
 
	ResolverObject object;
 

	
 
	if (ti->tileh != SLOPE_FLAT) {
 
		bool draw_old_one = true;
 
		if (HasBit(airts->callback_flags, CBM_AIRT_DRAW_FOUNDATIONS)) {
 
		if (HasBit(airts->callback_mask, CBM_AIRT_DRAW_FOUNDATIONS)) {
 
			/* Called to determine the type (if any) of foundation to draw */
 
			uint32 callback_res = GetAirportTileCallback(CBID_AIRPTILE_DRAW_FOUNDATIONS, 0, 0, gfx, st, ti->tile);
 
			draw_old_one = (callback_res != 0);
 
		}
 

	
 
		if (draw_old_one) DrawFoundation(ti, FOUNDATION_LEVELED);
 
@@ -307,13 +307,13 @@ void AnimateAirportTile(TileIndex tile)
 
{
 
	Station *st = Station::GetByTile(tile);
 
	StationGfx gfx = GetAirportGfx(tile);
 
	const AirportTileSpec *ats = AirportTileSpec::Get(gfx);
 
	uint8 animation_speed = ats->animation_speed;
 

	
 
	if (HasBit(ats->callback_flags, CBM_AIRT_ANIM_SPEED)) {
 
	if (HasBit(ats->callback_mask, CBM_AIRT_ANIM_SPEED)) {
 
		uint16 callback_res = GetAirportTileCallback(CBID_AIRPTILE_ANIMATION_SPEED, 0, 0, gfx, st, tile);
 
		if (callback_res != CALLBACK_FAILED) animation_speed = Clamp(callback_res & 0xFF, 0, 16);
 
	}
 

	
 
	/* An animation speed of 2 means the animation frame changes 4 ticks, and
 
	 * increasing this value by one doubles the wait. 0 is the minimum value
 
@@ -322,13 +322,13 @@ void AnimateAirportTile(TileIndex tile)
 
	if ((_tick_counter % (1 << animation_speed)) != 0) return;
 

	
 
	bool frame_set_by_callback = false;
 
	uint8 frame      = GetStationAnimationFrame(tile);
 
	uint16 num_frames = GB(ats->animation_info, 0, 8);
 

	
 
	if (HasBit(ats->callback_flags, CBM_AIRT_ANIM_NEXT_FRAME)) {
 
	if (HasBit(ats->callback_mask, CBM_AIRT_ANIM_NEXT_FRAME)) {
 
		uint16 callback_res = GetAirportTileCallback(CBID_AIRPTILE_ANIM_NEXT_FRAME, HasBit(ats->animation_special_flags, 0) ? Random() : 0, 0, gfx, st, tile);
 

	
 
		if (callback_res != CALLBACK_FAILED) {
 
			frame_set_by_callback = true;
 

	
 
			switch (callback_res & 0xFF) {
src/newgrf_airporttiles.h
Show inline comments
 
@@ -30,13 +30,13 @@ enum AirpAnimationTrigger {
 
 */
 
struct AirportTileSpec {
 
	uint16 animation_info;                ///< Information about the animation (is it looping, how many loops etc)
 
	uint8 animation_speed;                ///< The speed of the animation
 

	
 
	StringID name;                        ///< Tile Subname string, land information on this tile will give you "AirportName (TileSubname)"
 
	uint8 callback_flags;                 ///< Flags telling which grf callback is set
 
	uint8 callback_mask;                  ///< Bitmask telling which grf callback is set
 
	uint8 animation_triggers;             ///< When to start the animation
 
	uint8 animation_special_flags;        ///< Extra flags to influence the animation
 
	bool enabled;                         ///< entity still available (by default true). newgrf can disable it, though
 
	GRFFileProps grf_prop;                ///< properties related the the grf file
 

	
 
	static const AirportTileSpec *Get(StationGfx gfx);
src/table/newgrf_debug_data.h
Show inline comments
 
@@ -338,13 +338,13 @@ static const NIFeature _nif_railtype = {
 
	0
 
};
 

	
 

	
 
/*** NewGRF airport tiles ***/
 

	
 
#define NICAT(cb_id, bit) NIC(cb_id, AirportTileSpec, callback_flags, bit)
 
#define NICAT(cb_id, bit) NIC(cb_id, AirportTileSpec, callback_mask, bit)
 
static const NICallback _nic_airporttiles[] = {
 
	NICAT(CBID_AIRPTILE_DRAW_FOUNDATIONS, CBM_AIRT_DRAW_FOUNDATIONS),
 
	NICAT(CBID_AIRPTILE_ANIM_START_STOP,  CBM_NO_BIT),
 
	NICAT(CBID_AIRPTILE_ANIM_NEXT_FRAME,  CBM_AIRT_ANIM_NEXT_FRAME),
 
	NICAT(CBID_AIRPTILE_ANIMATION_SPEED,  CBM_AIRT_ANIM_SPEED),
 
	NIC_END()
0 comments (0 inline, 0 general)