Changeset - r15924:f5bba173626e
[Not reviewed]
master
0 14 0
rubidium - 14 years ago 2010-08-26 14:45:45
rubidium@openttd.org
(svn r20622) -Codechange: unify [GS]et[Statation|Object|Industry|House]AnimationFrame
14 files changed with 83 insertions and 154 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -224,7 +224,7 @@ static void IndustryDrawSugarMine(const 
 
{
 
	if (!IsIndustryCompleted(ti->tile)) return;
 

	
 
	const DrawIndustryAnimationStruct *d = &_draw_industry_spec1[GetIndustryAnimationState(ti->tile)];
 
	const DrawIndustryAnimationStruct *d = &_draw_industry_spec1[GetAnimationFrame(ti->tile)];
 

	
 
	AddChildSpriteScreen(SPR_IT_SUGAR_MINE_SIEVE + d->image_1, PAL_NONE, d->x, 0);
 

	
 
@@ -243,7 +243,7 @@ static void IndustryDrawToffeeQuarry(con
 
	uint8 x = 0;
 

	
 
	if (IsIndustryCompleted(ti->tile)) {
 
		x = _industry_anim_offs_toffee[GetIndustryAnimationState(ti->tile)];
 
		x = _industry_anim_offs_toffee[GetAnimationFrame(ti->tile)];
 
		if (x == 0xFF) {
 
			x = 0;
 
		}
 
@@ -256,7 +256,7 @@ static void IndustryDrawToffeeQuarry(con
 
static void IndustryDrawBubbleGenerator( const TileInfo *ti)
 
{
 
	if (IsIndustryCompleted(ti->tile)) {
 
		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_BUBBLE, PAL_NONE, 5, _industry_anim_offs_bubbles[GetIndustryAnimationState(ti->tile)]);
 
		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_BUBBLE, PAL_NONE, 5, _industry_anim_offs_bubbles[GetAnimationFrame(ti->tile)]);
 
	} else {
 
		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_SPRING, PAL_NONE, 3, 67);
 
	}
 
@@ -264,7 +264,7 @@ static void IndustryDrawBubbleGenerator(
 

	
 
static void IndustryDrawToyFactory(const TileInfo *ti)
 
{
 
	const DrawIndustryAnimationStruct *d = &_industry_anim_offs_toys[GetIndustryAnimationState(ti->tile)];
 
	const DrawIndustryAnimationStruct *d = &_industry_anim_offs_toys[GetAnimationFrame(ti->tile)];
 

	
 
	if (d->image_1 != 0xFF) {
 
		AddChildSpriteScreen(SPR_IT_TOY_FACTORY_CLAY, PAL_NONE, d->x, 96 + d->image_1);
 
@@ -281,7 +281,7 @@ static void IndustryDrawToyFactory(const
 
static void IndustryDrawCoalPlantSparks(const TileInfo *ti)
 
{
 
	if (IsIndustryCompleted(ti->tile)) {
 
		uint8 image = GetIndustryAnimationState(ti->tile);
 
		uint8 image = GetAnimationFrame(ti->tile);
 

	
 
		if (image != 0 && image < 7) {
 
			AddChildSpriteScreen(image + SPR_IT_POWER_PLANT_TRANSFORMERS,
 
@@ -328,7 +328,7 @@ static void DrawTile_Industry(TileInfo *
 
	}
 

	
 
	const DrawBuildingsTileStruct *dits = &_industry_draw_tile_data[gfx << 2 | (indts->anim_state ?
 
			GetIndustryAnimationState(ti->tile) & INDUSTRY_COMPLETED :
 
			GetAnimationFrame(ti->tile) & INDUSTRY_COMPLETED :
 
			GetIndustryConstructionStage(ti->tile))];
 

	
 
	SpriteID image = dits->ground.sprite;
 
@@ -541,7 +541,7 @@ static void AnimateTile_Industry(TileInd
 
	switch (gfx) {
 
	case GFX_SUGAR_MINE_SIEVE:
 
		if ((_tick_counter & 1) == 0) {
 
			byte m = GetIndustryAnimationState(tile) + 1;
 
			byte m = GetAnimationFrame(tile) + 1;
 

	
 
			switch (m & 7) {
 
			case 2: SndPlayTileFx(SND_2D_RIP_2, tile); break;
 
@@ -552,7 +552,7 @@ static void AnimateTile_Industry(TileInd
 
				m = 0;
 
				DeleteAnimatedTile(tile);
 
			}
 
			SetIndustryAnimationState(tile, m);
 
			SetAnimationFrame(tile, m);
 

	
 
			MarkTileDirtyByTile(tile);
 
		}
 
@@ -560,7 +560,7 @@ static void AnimateTile_Industry(TileInd
 

	
 
	case GFX_TOFFEE_QUARY:
 
		if ((_tick_counter & 3) == 0) {
 
			byte m = GetIndustryAnimationState(tile);
 
			byte m = GetAnimationFrame(tile);
 

	
 
			if (_industry_anim_offs_toffee[m] == 0xFF) {
 
				SndPlayTileFx(SND_30_CARTOON_SOUND, tile);
 
@@ -570,7 +570,7 @@ static void AnimateTile_Industry(TileInd
 
				m = 0;
 
				DeleteAnimatedTile(tile);
 
			}
 
			SetIndustryAnimationState(tile, m);
 
			SetAnimationFrame(tile, m);
 

	
 
			MarkTileDirtyByTile(tile);
 
		}
 
@@ -578,13 +578,13 @@ static void AnimateTile_Industry(TileInd
 

	
 
	case GFX_BUBBLE_CATCHER:
 
		if ((_tick_counter & 1) == 0) {
 
			byte m = GetIndustryAnimationState(tile);
 
			byte m = GetAnimationFrame(tile);
 

	
 
			if (++m >= 40) {
 
				m = 0;
 
				DeleteAnimatedTile(tile);
 
			}
 
			SetIndustryAnimationState(tile, m);
 
			SetAnimationFrame(tile, m);
 

	
 
			MarkTileDirtyByTile(tile);
 
		}
 
@@ -593,12 +593,12 @@ static void AnimateTile_Industry(TileInd
 
	/* Sparks on a coal plant */
 
	case GFX_POWERPLANT_SPARKS:
 
		if ((_tick_counter & 3) == 0) {
 
			byte m = GetIndustryAnimationState(tile);
 
			byte m = GetAnimationFrame(tile);
 
			if (m == 6) {
 
				SetIndustryAnimationState(tile, 0);
 
				SetAnimationFrame(tile, 0);
 
				DeleteAnimatedTile(tile);
 
			} else {
 
				SetIndustryAnimationState(tile, m + 1);
 
				SetAnimationFrame(tile, m + 1);
 
				MarkTileDirtyByTile(tile);
 
			}
 
		}
 
@@ -606,7 +606,7 @@ static void AnimateTile_Industry(TileInd
 

	
 
	case GFX_TOY_FACTORY:
 
		if ((_tick_counter & 1) == 0) {
 
			byte m = GetIndustryAnimationState(tile) + 1;
 
			byte m = GetAnimationFrame(tile) + 1;
 

	
 
			switch (m) {
 
				case  1: SndPlayTileFx(SND_2C_MACHINERY, tile); break;
 
@@ -624,7 +624,7 @@ static void AnimateTile_Industry(TileInd
 
					}
 
			}
 

	
 
			SetIndustryAnimationState(tile, m);
 
			SetAnimationFrame(tile, m);
 
			MarkTileDirtyByTile(tile);
 
		}
 
		break;
 
@@ -649,13 +649,13 @@ static void AnimateTile_Industry(TileInd
 
			bool b = Chance16(1, 7);
 
			IndustryGfx gfx = GetIndustryGfx(tile);
 

	
 
			byte m = GetIndustryAnimationState(tile) + 1;
 
			byte m = GetAnimationFrame(tile) + 1;
 
			if (m == 4 && (m = 0, ++gfx) == GFX_OILWELL_ANIMATED_3 + 1 && (gfx = GFX_OILWELL_ANIMATED_1, b)) {
 
				SetIndustryGfx(tile, GFX_OILWELL_NOT_ANIMATED);
 
				SetIndustryConstructionStage(tile, 3);
 
				DeleteAnimatedTile(tile);
 
			} else {
 
				SetIndustryAnimationState(tile, m);
 
				SetAnimationFrame(tile, m);
 
				SetIndustryGfx(tile, gfx);
 
				MarkTileDirtyByTile(tile);
 
			}
 
@@ -671,26 +671,26 @@ static void AnimateTile_Industry(TileInd
 

	
 
			if (state < 0x1A0) {
 
				if (state < 0x20 || state >= 0x180) {
 
					byte m = GetIndustryAnimationState(tile);
 
					byte m = GetAnimationFrame(tile);
 
					if (!(m & 0x40)) {
 
						SetIndustryAnimationState(tile, m | 0x40);
 
						SetAnimationFrame(tile, m | 0x40);
 
						SndPlayTileFx(SND_0B_MINING_MACHINERY, tile);
 
					}
 
					if (state & 7) return;
 
				} else {
 
					if (state & 3) return;
 
				}
 
				byte m = (GetIndustryAnimationState(tile) + 1) | 0x40;
 
				byte m = (GetAnimationFrame(tile) + 1) | 0x40;
 
				if (m > 0xC2) m = 0xC0;
 
				SetIndustryAnimationState(tile, m);
 
				SetAnimationFrame(tile, m);
 
				MarkTileDirtyByTile(tile);
 
			} else if (state >= 0x200 && state < 0x3A0) {
 
				int i = (state < 0x220 || state >= 0x380) ? 7 : 3;
 
				if (state & i) return;
 

	
 
				byte m = (GetIndustryAnimationState(tile) & 0xBF) - 1;
 
				byte m = (GetAnimationFrame(tile) & 0xBF) - 1;
 
				if (m < 0x80) m = 0x82;
 
				SetIndustryAnimationState(tile, m);
 
				SetAnimationFrame(tile, m);
 
				MarkTileDirtyByTile(tile);
 
			}
 
			break;
 
@@ -754,7 +754,7 @@ static void MakeIndustryTileBigger(TileI
 
	case GFX_TOY_FACTORY:
 
	case GFX_BUBBLE_CATCHER:
 
	case GFX_TOFFEE_QUARY:
 
		SetIndustryAnimationState(tile, 0);
 
		SetAnimationFrame(tile, 0);
 
		SetIndustryAnimationLoop(tile, 0);
 
		break;
 

	
 
@@ -826,7 +826,7 @@ static void TileLoop_Industry(TileIndex 
 
				case GFX_GOLD_MINE_TOWER_NOT_ANIMATED:   gfx = GFX_GOLD_MINE_TOWER_ANIMATED;   break;
 
			}
 
			SetIndustryGfx(tile, gfx);
 
			SetIndustryAnimationState(tile, 0x80);
 
			SetAnimationFrame(tile, 0x80);
 
			AddAnimatedTile(tile);
 
		}
 
		break;
 
@@ -834,7 +834,7 @@ static void TileLoop_Industry(TileIndex 
 
	case GFX_OILWELL_NOT_ANIMATED:
 
		if (Chance16(1, 6)) {
 
			SetIndustryGfx(tile, GFX_OILWELL_ANIMATED_1);
 
			SetIndustryAnimationState(tile, 0);
 
			SetAnimationFrame(tile, 0);
 
			AddAnimatedTile(tile);
 
		}
 
		break;
src/industry_map.h
Show inline comments
 
@@ -229,29 +229,6 @@ static inline void SetIndustryAnimationL
 
}
 

	
 
/**
 
 * Get the animation state
 
 * @param tile the tile to get the animation state of
 
 * @pre IsTileType(tile, MP_INDUSTRY)
 
 */
 
static inline byte GetIndustryAnimationState(TileIndex tile)
 
{
 
	assert(IsTileType(tile, MP_INDUSTRY));
 
	return _me[tile].m7;
 
}
 

	
 
/**
 
 * Set the animation state
 
 * @param tile the tile to set the animation state of
 
 * @param state the new animation state
 
 * @pre IsTileType(tile, MP_INDUSTRY)
 
 */
 
static inline void SetIndustryAnimationState(TileIndex tile, byte state)
 
{
 
	assert(IsTileType(tile, MP_INDUSTRY));
 
	_me[tile].m7 = state;
 
}
 

	
 
/**
 
 * Get the random bits for this tile.
 
 * Used for grf callbacks
 
 * @param tile TileIndex of the tile to query
src/newgrf_airporttiles.cpp
Show inline comments
 
@@ -185,7 +185,7 @@ static uint32 AirportTileGetVariable(con
 
		case 0x43: return GetRelativePosition(tile, st->airport.tile);
 

	
 
		/* Animation frame of tile */
 
		case 0x44: return GetStationAnimationFrame(tile);
 
		case 0x44: return GetAnimationFrame(tile);
 

	
 
		/* Land info of nearby tiles */
 
		case 0x60: return GetNearbyAirportTileInformation(parameter, tile, st->index);
 
@@ -194,7 +194,7 @@ static uint32 AirportTileGetVariable(con
 
		case 0x61:
 
			tile = GetNearbyTile(parameter, tile);
 
			if (st->TileBelongsToAirport(tile)) {
 
				return GetStationAnimationFrame(tile);
 
				return GetAnimationFrame(tile);
 
			}
 
			return UINT_MAX;
 

	
 
@@ -322,7 +322,7 @@ void AnimateAirportTile(TileIndex tile)
 
	if ((_tick_counter % (1 << animation_speed)) != 0) return;
 

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

	
 
	if (HasBit(ats->callback_mask, CBM_AIRT_ANIM_NEXT_FRAME)) {
 
@@ -362,7 +362,7 @@ void AnimateAirportTile(TileIndex tile)
 
		}
 
	}
 

	
 
	SetStationAnimationFrame(tile, frame);
 
	SetAnimationFrame(tile, frame);
 
	MarkTileDirtyByTile(tile);
 
}
 

	
 
@@ -376,7 +376,7 @@ static void ChangeAirportTileAnimationFr
 
		case 0xFE: AddAnimatedTile(tile);    break;
 
		case 0xFF: DeleteAnimatedTile(tile); break;
 
		default:
 
			SetStationAnimationFrame(tile, callback_res & 0xFF);
 
			SetAnimationFrame(tile, callback_res & 0xFF);
 
			AddAnimatedTile(tile);
 
			break;
 
	}
src/newgrf_house.cpp
Show inline comments
 
@@ -286,7 +286,7 @@ static uint32 HouseGetVariable(const Res
 
		case 0x45: return _generating_world ? 1 : 0;
 

	
 
		/* Current animation frame. */
 
		case 0x46: return IsTileType(tile, MP_HOUSE) ? GetHouseAnimationFrame(tile) : 0;
 
		case 0x46: return IsTileType(tile, MP_HOUSE) ? GetAnimationFrame(tile) : 0;
 

	
 
		/* Position of the house */
 
		case 0x47: return TileY(tile) << 16 | TileX(tile);
 
@@ -309,7 +309,7 @@ static uint32 HouseGetVariable(const Res
 
		/* Current animation frame of nearby house tiles */
 
		case 0x63: {
 
			TileIndex testtile = GetNearbyTile(parameter, tile);
 
			return IsTileType(testtile, MP_HOUSE) ? GetHouseAnimationFrame(testtile) : 0;
 
			return IsTileType(testtile, MP_HOUSE) ? GetAnimationFrame(testtile) : 0;
 
		}
 

	
 
		/* Cargo acceptance history of nearby stations */
 
@@ -488,7 +488,7 @@ void AnimateNewHouseTile(TileIndex tile)
 
	 * maximum, corresponding to around 33 minutes. */
 
	if (_tick_counter % (1 << animation_speed) != 0) return;
 

	
 
	byte frame      = GetHouseAnimationFrame(tile);
 
	byte frame      = GetAnimationFrame(tile);
 
	byte num_frames = GB(hs->animation_frames, 0, 7);
 

	
 
	if (HasBit(hs->callback_mask, CBM_HOUSE_ANIMATION_NEXT_FRAME)) {
 
@@ -529,7 +529,7 @@ void AnimateNewHouseTile(TileIndex tile)
 
		}
 
	}
 

	
 
	SetHouseAnimationFrame(tile, frame);
 
	SetAnimationFrame(tile, frame);
 
	MarkTileDirtyByTile(tile);
 
}
 

	
 
@@ -540,7 +540,7 @@ void ChangeHouseAnimationFrame(const GRF
 
		case 0xFE: AddAnimatedTile(tile);    break;
 
		case 0xFF: DeleteAnimatedTile(tile); break;
 
		default:
 
			SetHouseAnimationFrame(tile, callback_result & 0xFF);
 
			SetAnimationFrame(tile, callback_result & 0xFF);
 
			AddAnimatedTile(tile);
 
			break;
 
	}
src/newgrf_industries.cpp
Show inline comments
 
@@ -251,7 +251,7 @@ uint32 IndustryGetVariable(const Resolve
 
		case 0x63:
 
			tile = GetNearbyTile(parameter, tile);
 
			if (IsTileType(tile, MP_INDUSTRY) && Industry::GetByTile(tile) == industry) {
 
				return GetIndustryAnimationState(tile);
 
				return GetAnimationFrame(tile);
 
			}
 
			return 0xFFFFFFFF;
 

	
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -87,7 +87,7 @@ static uint32 IndustryTileGetVariable(co
 
		case 0x43: return GetRelativePosition(tile, inds->location.tile);
 

	
 
		/* Animation frame. Like house variable 46 but can contain anything 0..FF. */
 
		case 0x44: return (IsTileType(tile, MP_INDUSTRY)) ? GetIndustryAnimationState(tile) : 0;
 
		case 0x44: return (IsTileType(tile, MP_INDUSTRY)) ? GetAnimationFrame(tile) : 0;
 

	
 
		/* Land info of nearby tiles */
 
		case 0x60: return GetNearbyIndustryTileInformation(parameter, tile, inds == NULL ? (IndustryID)INVALID_INDUSTRY : inds->index);
 
@@ -96,7 +96,7 @@ static uint32 IndustryTileGetVariable(co
 
		case 0x61:
 
			tile = GetNearbyTile(parameter, tile);
 
			if (IsTileType(tile, MP_INDUSTRY) && Industry::GetByTile(tile) == inds) {
 
				return GetIndustryAnimationState(tile);
 
				return GetAnimationFrame(tile);
 
			}
 
			return UINT_MAX;
 

	
 
@@ -316,7 +316,7 @@ void AnimateNewIndustryTile(TileIndex ti
 
	if ((_tick_counter % (1 << animation_speed)) != 0) return;
 

	
 
	bool frame_set_by_callback = false;
 
	byte frame = GetIndustryAnimationState(tile);
 
	byte frame = GetAnimationFrame(tile);
 
	uint16 num_frames = GB(itspec->animation_info, 0, 8);
 

	
 
	if (HasBit(itspec->callback_mask, CBM_INDT_ANIM_NEXT_FRAME)) {
 
@@ -357,7 +357,7 @@ void AnimateNewIndustryTile(TileIndex ti
 
		}
 
	}
 

	
 
	SetIndustryAnimationState(tile, frame);
 
	SetAnimationFrame(tile, frame);
 
	MarkTileDirtyByTile(tile);
 
}
 

	
 
@@ -371,7 +371,7 @@ static void ChangeIndustryTileAnimationF
 
		case 0xFE: AddAnimatedTile(tile);    break;
 
		case 0xFF: DeleteAnimatedTile(tile); break;
 
		default:
 
			SetIndustryAnimationState(tile, callback_res & 0xFF);
 
			SetAnimationFrame(tile, callback_res & 0xFF);
 
			AddAnimatedTile(tile);
 
			break;
 
	}
src/newgrf_station.cpp
Show inline comments
 
@@ -325,13 +325,13 @@ static uint32 StationGetVariable(const R
 
			return _svc.v49;
 

	
 
		case 0x4A: // Animation frame of tile
 
			return GetStationAnimationFrame(tile);
 
			return GetAnimationFrame(tile);
 

	
 
		/* Variables which use the parameter */
 
		/* Variables 0x60 to 0x65 are handled separately below */
 
		case 0x66: // Animation frame of nearby tile
 
			if (parameter != 0) tile = GetNearbyTile(parameter, tile);
 
			return st->TileBelongsToRailStation(tile) ? GetStationAnimationFrame(tile) : UINT_MAX;
 
			return st->TileBelongsToRailStation(tile) ? GetAnimationFrame(tile) : UINT_MAX;
 

	
 
		case 0x67: { // Land info of nearby tile
 
			Axis axis = GetRailStationAxis(tile);
 
@@ -827,7 +827,7 @@ void AnimateStationTile(TileIndex tile)
 

	
 
	if (_tick_counter % (1 << animation_speed) != 0) return;
 

	
 
	uint8 frame      = GetStationAnimationFrame(tile);
 
	uint8 frame      = GetAnimationFrame(tile);
 
	uint8 num_frames = ss->anim_frames;
 

	
 
	bool frame_set_by_callback = false;
 
@@ -871,7 +871,7 @@ void AnimateStationTile(TileIndex tile)
 
		}
 
	}
 

	
 
	SetStationAnimationFrame(tile, frame);
 
	SetAnimationFrame(tile, frame);
 
	MarkTileDirtyByTile(tile);
 
}
 

	
 
@@ -886,7 +886,7 @@ static void ChangeStationAnimationFrame(
 
		case 0xFE: AddAnimatedTile(tile);    break;
 
		case 0xFF: DeleteAnimatedTile(tile); break;
 
		default:
 
			SetStationAnimationFrame(tile, callback);
 
			SetAnimationFrame(tile, callback);
 
			AddAnimatedTile(tile);
 
			break;
 
	}
src/object_cmd.cpp
Show inline comments
 
@@ -89,13 +89,13 @@ static void IncreaseAnimationStage(TileI
 
{
 
	TileArea ta = Object::GetByTile(tile)->location;
 
	TILE_AREA_LOOP(t, ta) {
 
		SetObjectAnimationStage(t, GetObjectAnimationStage(t) + 1);
 
		SetAnimationFrame(t, GetAnimationFrame(t) + 1);
 
		MarkTileDirtyByTile(t);
 
	}
 
}
 

	
 
/** We encode the company HQ size in the animation stage. */
 
#define GetCompanyHQSize GetObjectAnimationStage
 
#define GetCompanyHQSize GetAnimationFrame
 
/** We encode the company HQ size in the animation stage. */
 
#define IncreaseCompanyHQSize IncreaseAnimationStage
 

	
src/object_map.h
Show inline comments
 
@@ -106,30 +106,6 @@ static inline bool IsStatueTile(TileInde
 
	return IsTileType(t, MP_OBJECT) && IsStatue(t);
 
}
 

	
 
/**
 
 * Get animation stage/counter of this tile.
 
 * @param t The tile to query.
 
 * @pre IsTileType(t, MP_OBJECT)
 
 * @return The animation 'stage' of the tile.
 
 */
 
static inline byte GetObjectAnimationStage(TileIndex t)
 
{
 
	assert(IsTileType(t, MP_OBJECT));
 
	return _me[t].m7;
 
}
 

	
 
/**
 
 * Set animation stage/counter of this tile.
 
 * @param t     The tile to query.
 
 * @param stage The stage of this tile.
 
 * @pre IsTileType(t, MP_OBJECT)
 
 */
 
static inline void SetObjectAnimationStage(TileIndex t, uint8 stage)
 
{
 
	assert(IsTileType(t, MP_OBJECT));
 
	_me[t].m7 = stage;
 
}
 

	
 

	
 
/**
 
 * Make an Object tile.
src/saveload/afterload.cpp
Show inline comments
 
@@ -2176,7 +2176,7 @@ bool AfterLoadGame()
 
						break;
 
					}
 
					if (old_gfx < atc[i].old_start + atc[i].num_frames) {
 
						SetStationAnimationFrame(t, old_gfx - atc[i].old_start);
 
						SetAnimationFrame(t, old_gfx - atc[i].old_start);
 
						SetStationGfx(t, atc[i].old_start - offset);
 
						break;
 
					}
src/station_cmd.cpp
Show inline comments
 
@@ -1277,7 +1277,7 @@ CommandCost CmdBuildRailStation(TileInde
 

	
 
				SetCustomStationSpecIndex(tile, specindex);
 
				SetStationTileRandomBits(tile, GB(Random(), 0, 4));
 
				SetStationAnimationFrame(tile, 0);
 
				SetAnimationFrame(tile, 0);
 

	
 
				if (statspec != NULL) {
 
					/* Use a fixed axis for GetPlatformInfo as our platforms / numtracks are always the right way around */
 
@@ -2578,19 +2578,19 @@ static void DrawTile_Station(TileInfo *t
 
		}
 
		switch (gfx) {
 
			case APT_RADAR_GRASS_FENCE_SW:
 
				t = &_station_display_datas_airport_radar_grass_fence_sw[GetStationAnimationFrame(ti->tile)];
 
				t = &_station_display_datas_airport_radar_grass_fence_sw[GetAnimationFrame(ti->tile)];
 
				break;
 
			case APT_GRASS_FENCE_NE_FLAG:
 
				t = &_station_display_datas_airport_flag_grass_fence_ne[GetStationAnimationFrame(ti->tile)];
 
				t = &_station_display_datas_airport_flag_grass_fence_ne[GetAnimationFrame(ti->tile)];
 
				break;
 
			case APT_RADAR_FENCE_SW:
 
				t = &_station_display_datas_airport_radar_fence_sw[GetStationAnimationFrame(ti->tile)];
 
				t = &_station_display_datas_airport_radar_fence_sw[GetAnimationFrame(ti->tile)];
 
				break;
 
			case APT_RADAR_FENCE_NE:
 
				t = &_station_display_datas_airport_radar_fence_ne[GetStationAnimationFrame(ti->tile)];
 
				t = &_station_display_datas_airport_radar_fence_ne[GetAnimationFrame(ti->tile)];
 
				break;
 
			case APT_GRASS_FENCE_NE_FLAG_2:
 
				t = &_station_display_datas_airport_flag_grass_fence_ne_2[GetStationAnimationFrame(ti->tile)];
 
				t = &_station_display_datas_airport_flag_grass_fence_ne_2[GetAnimationFrame(ti->tile)];
 
				break;
 
		}
 
	}
src/station_map.h
Show inline comments
 
@@ -85,30 +85,6 @@ static inline void SetStationGfx(TileInd
 
}
 

	
 
/**
 
 * Get the station's animation frame of this tile
 
 * @param t the tile to query
 
 * @pre IsTileType(t, MP_STATION)
 
 * @return the station's animation frame
 
 */
 
static inline uint8 GetStationAnimationFrame(TileIndex t)
 
{
 
	assert(IsTileType(t, MP_STATION));
 
	return _me[t].m7;
 
}
 

	
 
/**
 
 * Set the station's animation frame of this tile
 
 * @param t the tile to update
 
 * @param frame the new frame
 
 * @pre IsTileType(t, MP_STATION)
 
 */
 
static inline void SetStationAnimationFrame(TileIndex t, uint8 frame)
 
{
 
	assert(IsTileType(t, MP_STATION));
 
	_me[t].m7 = frame;
 
}
 

	
 
/**
 
 * Is this station tile a rail station?
 
 * @param t the tile to get the information from
 
 * @pre IsTileType(t, MP_STATION)
src/tile_map.h
Show inline comments
 
@@ -202,6 +202,30 @@ static inline TropicZone GetTropicZone(T
 
	return (TropicZone)GB(_m[tile].m6, 0, 2);
 
}
 

	
 
/**
 
 * Get the current animation frame
 
 * @param t the tile
 
 * @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION)
 
 * @return frame number
 
 */
 
static inline byte GetAnimationFrame(TileIndex t)
 
{
 
	assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION));
 
	return _me[t].m7;
 
}
 

	
 
/**
 
 * Set a new animation frame
 
 * @param t the tile
 
 * @param frame the new frame number
 
 * @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION)
 
 */
 
static inline void SetAnimationFrame(TileIndex t, byte frame)
 
{
 
	assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION));
 
	_me[t].m7 = frame;
 
}
 

	
 
Slope GetTileSlope(TileIndex tile, uint *h);
 
uint GetTileZ(TileIndex tile);
 
uint GetTileMaxZ(TileIndex tile);
src/town_map.h
Show inline comments
 
@@ -140,30 +140,6 @@ static inline void SetLiftPosition(TileI
 
}
 

	
 
/**
 
 * Get the current animation frame for this house
 
 * @param t the tile
 
 * @pre IsTileType(t, MP_HOUSE)
 
 * @return frame number
 
 */
 
static inline byte GetHouseAnimationFrame(TileIndex t)
 
{
 
	assert(IsTileType(t, MP_HOUSE));
 
	return _me[t].m7;
 
}
 

	
 
/**
 
 * Set a new animation frame for this house
 
 * @param t the tile
 
 * @param frame the new frame number
 
 * @pre IsTileType(t, MP_HOUSE)
 
 */
 
static inline void SetHouseAnimationFrame(TileIndex t, byte frame)
 
{
 
	assert(IsTileType(t, MP_HOUSE));
 
	_me[t].m7 = frame;
 
}
 

	
 
/**
 
 * Get the completion of this house
 
 * @param t the tile
 
 * @return true if it is, false if it is not
 
@@ -386,7 +362,7 @@ static inline void MakeHouseTile(TileInd
 
	SetHouseType(t, type);
 
	SetHouseCompleted(t, stage == TOWN_HOUSE_COMPLETED);
 
	_m[t].m5 = IsHouseCompleted(t) ? 0 : (stage << 3 | counter);
 
	SetHouseAnimationFrame(t, 0);
 
	SetAnimationFrame(t, 0);
 
	SetHouseProcessingTime(t, HouseSpec::Get(type)->processing_time);
 
}
 

	
0 comments (0 inline, 0 general)