summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-26 14:45:45 +0000
committerrubidium <rubidium@openttd.org>2010-08-26 14:45:45 +0000
commit4efa2efdbba6f08b2ee4ca3aacb2aeb792429af4 (patch)
tree60ad5b19a5b1e1131aee081bdeea8f4d6a83af1e /src
parent7f86dcca90b20241a210dd5f088e249a902f725c (diff)
downloadopenttd-4efa2efdbba6f08b2ee4ca3aacb2aeb792429af4.tar.xz
(svn r20622) -Codechange: unify [GS]et[Statation|Object|Industry|House]AnimationFrame
Diffstat (limited to 'src')
-rw-r--r--src/industry_cmd.cpp56
-rw-r--r--src/industry_map.h23
-rw-r--r--src/newgrf_airporttiles.cpp10
-rw-r--r--src/newgrf_house.cpp10
-rw-r--r--src/newgrf_industries.cpp2
-rw-r--r--src/newgrf_industrytiles.cpp10
-rw-r--r--src/newgrf_station.cpp10
-rw-r--r--src/object_cmd.cpp4
-rw-r--r--src/object_map.h24
-rw-r--r--src/saveload/afterload.cpp2
-rw-r--r--src/station_cmd.cpp12
-rw-r--r--src/station_map.h24
-rw-r--r--src/tile_map.h24
-rw-r--r--src/town_map.h26
14 files changed, 83 insertions, 154 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 379b776c9..b684531a3 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -224,7 +224,7 @@ static void IndustryDrawSugarMine(const TileInfo *ti)
{
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(const TileInfo *ti)
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(const TileInfo *ti)
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( const TileInfo *ti)
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 TileInfo *ti)
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 *ti)
}
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(TileIndex tile)
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(TileIndex tile)
m = 0;
DeleteAnimatedTile(tile);
}
- SetIndustryAnimationState(tile, m);
+ SetAnimationFrame(tile, m);
MarkTileDirtyByTile(tile);
}
@@ -560,7 +560,7 @@ static void AnimateTile_Industry(TileIndex tile)
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(TileIndex tile)
m = 0;
DeleteAnimatedTile(tile);
}
- SetIndustryAnimationState(tile, m);
+ SetAnimationFrame(tile, m);
MarkTileDirtyByTile(tile);
}
@@ -578,13 +578,13 @@ static void AnimateTile_Industry(TileIndex tile)
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(TileIndex tile)
/* 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(TileIndex tile)
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(TileIndex tile)
}
}
- SetIndustryAnimationState(tile, m);
+ SetAnimationFrame(tile, m);
MarkTileDirtyByTile(tile);
}
break;
@@ -649,13 +649,13 @@ static void AnimateTile_Industry(TileIndex tile)
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(TileIndex tile)
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(TileIndex tile)
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 tile)
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 tile)
case GFX_OILWELL_NOT_ANIMATED:
if (Chance16(1, 6)) {
SetIndustryGfx(tile, GFX_OILWELL_ANIMATED_1);
- SetIndustryAnimationState(tile, 0);
+ SetAnimationFrame(tile, 0);
AddAnimatedTile(tile);
}
break;
diff --git a/src/industry_map.h b/src/industry_map.h
index 5cf335be0..39d8169e6 100644
--- a/src/industry_map.h
+++ b/src/industry_map.h
@@ -229,29 +229,6 @@ static inline void SetIndustryAnimationLoop(TileIndex tile, byte count)
}
/**
- * 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
diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp
index 896f0f55f..c963c7da3 100644
--- a/src/newgrf_airporttiles.cpp
+++ b/src/newgrf_airporttiles.cpp
@@ -185,7 +185,7 @@ static uint32 AirportTileGetVariable(const ResolverObject *object, byte variable
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(const ResolverObject *object, byte variable
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 ChangeAirportTileAnimationFrame(const AirportTileSpec *ats, TileInde
case 0xFE: AddAnimatedTile(tile); break;
case 0xFF: DeleteAnimatedTile(tile); break;
default:
- SetStationAnimationFrame(tile, callback_res & 0xFF);
+ SetAnimationFrame(tile, callback_res & 0xFF);
AddAnimatedTile(tile);
break;
}
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index cc0c62521..402847f8b 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -286,7 +286,7 @@ static uint32 HouseGetVariable(const ResolverObject *object, byte variable, byte
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 ResolverObject *object, byte variable, byte
/* 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 GRFFile *file, TileIndex tile, uint16 callb
case 0xFE: AddAnimatedTile(tile); break;
case 0xFF: DeleteAnimatedTile(tile); break;
default:
- SetHouseAnimationFrame(tile, callback_result & 0xFF);
+ SetAnimationFrame(tile, callback_result & 0xFF);
AddAnimatedTile(tile);
break;
}
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 732d865eb..dfdf1019a 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -251,7 +251,7 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par
case 0x63:
tile = GetNearbyTile(parameter, tile);
if (IsTileType(tile, MP_INDUSTRY) && Industry::GetByTile(tile) == industry) {
- return GetIndustryAnimationState(tile);
+ return GetAnimationFrame(tile);
}
return 0xFFFFFFFF;
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 3fcdac555..afbbbf5cb 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -87,7 +87,7 @@ static uint32 IndustryTileGetVariable(const ResolverObject *object, byte variabl
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(const ResolverObject *object, byte variabl
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 tile)
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 tile)
}
}
- SetIndustryAnimationState(tile, frame);
+ SetAnimationFrame(tile, frame);
MarkTileDirtyByTile(tile);
}
@@ -371,7 +371,7 @@ static void ChangeIndustryTileAnimationFrame(const IndustryTileSpec *itspec, Til
case 0xFE: AddAnimatedTile(tile); break;
case 0xFF: DeleteAnimatedTile(tile); break;
default:
- SetIndustryAnimationState(tile, callback_res & 0xFF);
+ SetAnimationFrame(tile, callback_res & 0xFF);
AddAnimatedTile(tile);
break;
}
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index e5109e073..b9d75348a 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -325,13 +325,13 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
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(const StationSpec *ss, const BaseStation
case 0xFE: AddAnimatedTile(tile); break;
case 0xFF: DeleteAnimatedTile(tile); break;
default:
- SetStationAnimationFrame(tile, callback);
+ SetAnimationFrame(tile, callback);
AddAnimatedTile(tile);
break;
}
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index 1db6ed1f9..571395798 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -89,13 +89,13 @@ static void IncreaseAnimationStage(TileIndex tile)
{
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
diff --git a/src/object_map.h b/src/object_map.h
index bf6e33858..06485d8ff 100644
--- a/src/object_map.h
+++ b/src/object_map.h
@@ -106,30 +106,6 @@ static inline bool IsStatueTile(TileIndex t)
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.
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 23b7aebfd..95b86f4d6 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -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;
}
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index a8c7737fd..d4f4b56f5 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1277,7 +1277,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
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 *ti)
}
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;
}
}
diff --git a/src/station_map.h b/src/station_map.h
index c641c6a33..c8204c40e 100644
--- a/src/station_map.h
+++ b/src/station_map.h
@@ -85,30 +85,6 @@ static inline void SetStationGfx(TileIndex t, StationGfx gfx)
}
/**
- * 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)
diff --git a/src/tile_map.h b/src/tile_map.h
index 7310fc599..420421e40 100644
--- a/src/tile_map.h
+++ b/src/tile_map.h
@@ -202,6 +202,30 @@ static inline TropicZone GetTropicZone(TileIndex tile)
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);
diff --git a/src/town_map.h b/src/town_map.h
index 41f1e96e4..eb7ddb8d2 100644
--- a/src/town_map.h
+++ b/src/town_map.h
@@ -140,30 +140,6 @@ static inline void SetLiftPosition(TileIndex t, byte pos)
}
/**
- * 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(TileIndex t, TownID tid, byte counter, byte sta
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);
}