equal
deleted
inserted
replaced
75 * @param t the tile |
75 * @param t the tile |
76 * @return has destination |
76 * @return has destination |
77 */ |
77 */ |
78 static inline bool LiftHasDestination(TileIndex t) |
78 static inline bool LiftHasDestination(TileIndex t) |
79 { |
79 { |
80 return HASBIT(_me[t].m7, 0); |
80 return HasBit(_me[t].m7, 0); |
81 } |
81 } |
82 |
82 |
83 /** |
83 /** |
84 * Set the new destination of the lift for this animated house, and activate |
84 * Set the new destination of the lift for this animated house, and activate |
85 * the LiftHasDestination bit. |
85 * the LiftHasDestination bit. |
86 * @param t the tile |
86 * @param t the tile |
87 * @param dest new destination |
87 * @param dest new destination |
88 */ |
88 */ |
89 static inline void SetLiftDestination(TileIndex t, byte dest) |
89 static inline void SetLiftDestination(TileIndex t, byte dest) |
90 { |
90 { |
91 SETBIT(_me[t].m7, 0); |
91 SetBit(_me[t].m7, 0); |
92 SB(_me[t].m7, 1, 3, dest); |
92 SB(_me[t].m7, 1, 3, dest); |
93 } |
93 } |
94 |
94 |
95 /** |
95 /** |
96 * Get the current destination for this lift |
96 * Get the current destination for this lift |
164 * @return true if it is, false if it is not |
164 * @return true if it is, false if it is not |
165 */ |
165 */ |
166 static inline bool IsHouseCompleted(TileIndex t) |
166 static inline bool IsHouseCompleted(TileIndex t) |
167 { |
167 { |
168 assert(IsTileType(t, MP_HOUSE)); |
168 assert(IsTileType(t, MP_HOUSE)); |
169 return HASBIT(_m[t].m3, 7); |
169 return HasBit(_m[t].m3, 7); |
170 } |
170 } |
171 |
171 |
172 /** |
172 /** |
173 * Mark this house as been completed |
173 * Mark this house as been completed |
174 * @param t the tile |
174 * @param t the tile |
281 |
281 |
282 if (GB(_m[t].m5, 3, 2) == TOWN_HOUSE_COMPLETED) { |
282 if (GB(_m[t].m5, 3, 2) == TOWN_HOUSE_COMPLETED) { |
283 /* House is now completed. |
283 /* House is now completed. |
284 * Store the year of construction as well, for newgrf house purpose */ |
284 * Store the year of construction as well, for newgrf house purpose */ |
285 SetHouseCompleted(t, true); |
285 SetHouseCompleted(t, true); |
286 _m[t].m5 = clamp(_cur_year - ORIGINAL_BASE_YEAR, 0, 0xFF); |
286 _m[t].m5 = Clamp(_cur_year - ORIGINAL_BASE_YEAR, 0, 0xFF); |
287 } |
287 } |
288 } |
288 } |
289 |
289 |
290 /** |
290 /** |
291 * Get the year that this house was constructed (between 1920 and 2175). |
291 * Get the year that this house was constructed (between 1920 and 2175). |
295 */ |
295 */ |
296 static inline Year GetHouseConstructionYear(TileIndex t) |
296 static inline Year GetHouseConstructionYear(TileIndex t) |
297 { |
297 { |
298 assert(IsTileType(t, MP_HOUSE)); |
298 assert(IsTileType(t, MP_HOUSE)); |
299 return IsHouseCompleted(t) ? _m[t].m5 + ORIGINAL_BASE_YEAR : 0; |
299 return IsHouseCompleted(t) ? _m[t].m5 + ORIGINAL_BASE_YEAR : 0; |
|
300 } |
|
301 |
|
302 /** |
|
303 * Set the random bits for this house. |
|
304 * This is required for newgrf house |
|
305 * @param t the tile of this house |
|
306 * @param random the new random bits |
|
307 * @pre IsTileType(t, MP_HOUSE) |
|
308 */ |
|
309 static inline void SetHouseRandomBits(TileIndex t, byte random) |
|
310 { |
|
311 assert(IsTileType(t, MP_HOUSE)); |
|
312 _m[t].m1 = random; |
300 } |
313 } |
301 |
314 |
302 /** |
315 /** |
303 * Get the random bits for this house. |
316 * Get the random bits for this house. |
304 * This is required for newgrf house |
317 * This is required for newgrf house |