src/town_map.h
branchNewGRF_ports
changeset 10994 cd9968b6f96b
parent 10274 b3c58f3df92b
equal deleted inserted replaced
10991:d8811e327d12 10994:cd9968b6f96b
   263 		SetHouseCompleted(t, true);
   263 		SetHouseCompleted(t, true);
   264 	}
   264 	}
   265 }
   265 }
   266 
   266 
   267 /**
   267 /**
   268  * Set the year that this house was constructed (between 1920 and 2175).
   268  * Set the year that this house was constructed.
   269  * @param t the tile of this house
   269  * @param t the tile of this house
   270  * @param year the year to set
   270  * @param year the year to set
   271  * @pre IsTileType(t, MP_HOUSE) && IsHouseCompleted(t)
   271  * @pre IsTileType(t, MP_HOUSE) && IsHouseCompleted(t)
   272  */
   272  */
   273 static inline void SetHouseConstructionYear(TileIndex t, Year year)
   273 static inline void SetHouseConstructionYear(TileIndex t, Year year)
   274 {
   274 {
   275 	assert(IsTileType(t, MP_HOUSE) && IsHouseCompleted(t));
   275 	assert(IsTileType(t, MP_HOUSE) && IsHouseCompleted(t));
   276 	_m[t].m5 = Clamp(year - ORIGINAL_BASE_YEAR, 0, 0xFF);
   276 	_m[t].m5 = Clamp(year - GetHouseSpecs(GetHouseType(t))->min_year, 0, 0xFF);
   277 }
   277 }
   278 
   278 
   279 /**
   279 /**
   280  * Get the year that this house was constructed (between 1920 and 2175).
   280  * Get the year that this house was constructed.
   281  * @param t the tile of this house
   281  * @param t the tile of this house
   282  * @pre IsTileType(t, MP_HOUSE)
   282  * @pre IsTileType(t, MP_HOUSE)
   283  * @return year
   283  * @return year
   284  */
   284  */
   285 static inline Year GetHouseConstructionYear(TileIndex t)
   285 static inline Year GetHouseConstructionYear(TileIndex t)
   286 {
   286 {
   287 	assert(IsTileType(t, MP_HOUSE));
   287 	assert(IsTileType(t, MP_HOUSE));
   288 	return IsHouseCompleted(t) ? _m[t].m5 + ORIGINAL_BASE_YEAR : 0;
   288 	return IsHouseCompleted(t) ? _m[t].m5 + GetHouseSpecs(GetHouseType(t))->min_year : 0;
   289 }
   289 }
   290 
   290 
   291 /**
   291 /**
   292  * Set the random bits for this house.
   292  * Set the random bits for this house.
   293  * This is required for newgrf house
   293  * This is required for newgrf house