diff src/town_map.h @ 15933:8ac5258d7680 draft

(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)
author rubidium <rubidium@openttd.org>
date Thu, 26 Aug 2010 14:36:00 +0000
parents a899d4e5ee1a
children 3172190fa127
line wrap: on
line diff
--- a/src/town_map.h
+++ b/src/town_map.h
@@ -148,7 +148,7 @@
 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 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 @@
 }
 
 /**
- * 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 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 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 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 */