205 SetHouseType(t, type); |
202 SetHouseType(t, type); |
206 SetHouseCompleted(t, stage == TOWN_HOUSE_COMPLETED); |
203 SetHouseCompleted(t, stage == TOWN_HOUSE_COMPLETED); |
207 _m[t].m5 = IsHouseCompleted(t) ? 0 : (stage << 3 | counter); |
204 _m[t].m5 = IsHouseCompleted(t) ? 0 : (stage << 3 | counter); |
208 SetHouseAnimationFrame(t, 0); |
205 SetHouseAnimationFrame(t, 0); |
209 _me[t].m7 = GetHouseSpecs(type)->processing_time; |
206 _me[t].m7 = GetHouseSpecs(type)->processing_time; |
210 |
|
211 if (GetHouseSpecs(type)->building_flags & BUILDING_IS_ANIMATED) AddAnimatedTile(t); |
|
212 MarkTileDirtyByTile(t); |
|
213 } |
207 } |
214 |
208 |
215 /** |
209 /** |
216 * House Construction Scheme. |
210 * House Construction Scheme. |
217 * Construction counter, for buildings under construction. Incremented on every |
211 * Construction counter, for buildings under construction. Incremented on every |
265 |
259 |
266 if (GB(_m[t].m5, 3, 2) == TOWN_HOUSE_COMPLETED) { |
260 if (GB(_m[t].m5, 3, 2) == TOWN_HOUSE_COMPLETED) { |
267 /* House is now completed. |
261 /* House is now completed. |
268 * Store the year of construction as well, for newgrf house purpose */ |
262 * Store the year of construction as well, for newgrf house purpose */ |
269 SetHouseCompleted(t, true); |
263 SetHouseCompleted(t, true); |
270 _m[t].m5 = Clamp(_cur_year - ORIGINAL_BASE_YEAR, 0, 0xFF); |
|
271 } |
264 } |
|
265 } |
|
266 |
|
267 /** |
|
268 * Set the year that this house was constructed (between 1920 and 2175). |
|
269 * @param t the tile of this house |
|
270 * @param year the year to set |
|
271 * @pre IsTileType(t, MP_HOUSE) && IsHouseCompleted(t) |
|
272 */ |
|
273 static inline void SetHouseConstructionYear(TileIndex t, Year year) |
|
274 { |
|
275 assert(IsTileType(t, MP_HOUSE) && IsHouseCompleted(t)); |
|
276 _m[t].m5 = Clamp(year - ORIGINAL_BASE_YEAR, 0, 0xFF); |
272 } |
277 } |
273 |
278 |
274 /** |
279 /** |
275 * Get the year that this house was constructed (between 1920 and 2175). |
280 * Get the year that this house was constructed (between 1920 and 2175). |
276 * @param t the tile of this house |
281 * @param t the tile of this house |