summaryrefslogtreecommitdiff
path: root/src/town_map.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-26 14:36:00 +0000
committerrubidium <rubidium@openttd.org>2010-08-26 14:36:00 +0000
commit7f86dcca90b20241a210dd5f088e249a902f725c (patch)
tree6793ebbb3e7395db1e51b19fb18ea3b6e196a337 /src/town_map.h
parent193800e0faef9711b48cedcf37feb896d9e0c448 (diff)
downloadopenttd-7f86dcca90b20241a210dd5f088e249a902f725c.tar.xz
(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
Diffstat (limited to 'src/town_map.h')
-rw-r--r--src/town_map.h61
1 files changed, 30 insertions, 31 deletions
diff --git a/src/town_map.h b/src/town_map.h
index c7bd2f527..41f1e96e4 100644
--- a/src/town_map.h
+++ b/src/town_map.h
@@ -148,7 +148,7 @@ static inline void SetLiftPosition(TileIndex t, byte pos)
static inline byte GetHouseAnimationFrame(TileIndex t)
{
assert(IsTileType(t, MP_HOUSE));
- return GB(_m[t].m6, 2, 6) | (GB(_m[t].m3, 5, 1) << 6);
+ return _me[t].m7;
}
/**
@@ -160,8 +160,7 @@ static inline byte GetHouseAnimationFrame(TileIndex t)
static inline void SetHouseAnimationFrame(TileIndex t, byte frame)
{
assert(IsTileType(t, MP_HOUSE));
- SB(_m[t].m6, 2, 6, GB(frame, 0, 6));
- SB(_m[t].m3, 5, 1, GB(frame, 6, 1));
+ _me[t].m7 = frame;
}
/**
@@ -187,31 +186,6 @@ static inline void SetHouseCompleted(TileIndex t, bool status)
}
/**
- * Make the tile a house.
- * @param t tile index
- * @param tid Town index
- * @param counter of construction step
- * @param stage of construction (used for drawing)
- * @param type of house. Index into house specs array
- * @param random_bits required for newgrf houses
- * @pre IsTileType(t, MP_CLEAR)
- */
-static inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, HouseID type, byte random_bits)
-{
- assert(IsTileType(t, MP_CLEAR));
-
- SetTileType(t, MP_HOUSE);
- _m[t].m1 = random_bits;
- _m[t].m2 = tid;
- _m[t].m3 = 0;
- SetHouseType(t, type);
- SetHouseCompleted(t, stage == TOWN_HOUSE_COMPLETED);
- _m[t].m5 = IsHouseCompleted(t) ? 0 : (stage << 3 | counter);
- SetHouseAnimationFrame(t, 0);
- _me[t].m7 = HouseSpec::Get(type)->processing_time;
-}
-
-/**
* House Construction Scheme.
* Construction counter, for buildings under construction. Incremented on every
* periodic tile processing.
@@ -365,7 +339,7 @@ static inline byte GetHouseTriggers(TileIndex t)
static inline byte GetHouseProcessingTime(TileIndex t)
{
assert(IsTileType(t, MP_HOUSE));
- return _me[t].m7;
+ return GB(_m[t].m6, 2, 6);
}
/**
@@ -377,7 +351,7 @@ static inline byte GetHouseProcessingTime(TileIndex t)
static inline void SetHouseProcessingTime(TileIndex t, byte time)
{
assert(IsTileType(t, MP_HOUSE));
- _me[t].m7 = time;
+ SB(_m[t].m6, 2, 6, time);
}
/**
@@ -388,7 +362,32 @@ static inline void SetHouseProcessingTime(TileIndex t, byte time)
static inline void DecHouseProcessingTime(TileIndex t)
{
assert(IsTileType(t, MP_HOUSE));
- _me[t].m7--;
+ _m[t].m6 -= 1 << 2;
+}
+
+/**
+ * Make the tile a house.
+ * @param t tile index
+ * @param tid Town index
+ * @param counter of construction step
+ * @param stage of construction (used for drawing)
+ * @param type of house. Index into house specs array
+ * @param random_bits required for newgrf houses
+ * @pre IsTileType(t, MP_CLEAR)
+ */
+static inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, HouseID type, byte random_bits)
+{
+ assert(IsTileType(t, MP_CLEAR));
+
+ SetTileType(t, MP_HOUSE);
+ _m[t].m1 = random_bits;
+ _m[t].m2 = tid;
+ _m[t].m3 = 0;
+ SetHouseType(t, type);
+ SetHouseCompleted(t, stage == TOWN_HOUSE_COMPLETED);
+ _m[t].m5 = IsHouseCompleted(t) ? 0 : (stage << 3 | counter);
+ SetHouseAnimationFrame(t, 0);
+ SetHouseProcessingTime(t, HouseSpec::Get(type)->processing_time);
}
#endif /* TOWN_MAP_H */