(svn r9823) -Feature: Add support for house property 1F - minimum life span.

This commit is contained in:
maedhros 2007-05-10 16:03:06 +00:00
parent 9643fd7638
commit 3cc31aae86
4 changed files with 9 additions and 3 deletions

View File

@ -1429,6 +1429,10 @@ static bool TownHouseChangeInfo(uint hid, int numinfo, int prop, byte **bufp, in
}
break;
case 0x1F: // Minimum life span
FOR_EACH_OBJECT housespec[i]->minimum_life = grf_load_byte(&buf);
break;
default:
ret = true;
break;

View File

@ -1804,7 +1804,7 @@ assert_compile(lengthof(_town_draw_tile_data) == (NEW_HOUSE_OFFSET) * 4 * 4);
*/
#define MS(mnd, mxd, p, rc, bn, rr, mg, ca1, ca2, ca3, bf, ba, cg1, cg2, cg3) \
{mnd, mxd, p, rc, bn, rr, mg, {ca1, ca2, ca3}, {cg1, cg2, cg3}, bf, ba, true, \
0, NULL, 0, 0, {0, 0, 0, 0}, 16, NO_EXTRA_FLAG, HOUSE_NO_CLASS, 0, 2, 0, 0, NULL}
0, NULL, 0, 0, {0, 0, 0, 0}, 16, NO_EXTRA_FLAG, HOUSE_NO_CLASS, 0, 2, 0, 0, 0, NULL}
/** House specifications from original data */
static const HouseSpec _original_house_specs[] = {
/**

View File

@ -164,10 +164,10 @@ struct HouseSpec {
CargoID accepts_cargo[3]; ///< 3 input cargo slots
BuildingFlags building_flags; ///< some flags that describe the house (size, stadium etc...)
HouseZones building_availability; ///< where can it be built (climates, zones)
bool enabled; ///< the house is still avaible (by default, true.newgrf can disable it, though)
bool enabled; ///< the house is available to build (true by default, but can be disabled by newgrf)
/* NewHouses properties */
HouseID substitute_id; ///< which house this one is based on
HouseID substitute_id; ///< which original house this one is based on
struct SpriteGroup *spritegroup; ///< pointer to the different sprites of the house
HouseID override; ///< which house this one replaces
uint16 callback_mask; ///< House callback flags
@ -178,6 +178,7 @@ struct HouseSpec {
byte animation_frames; ///< number of animation frames
byte animation_speed; ///< amount of time between each of those frames
byte processing_time; ///< Periodic refresh multiplier
byte minimum_life; ///< The minimum number of years this house will survive before the town rebuilds it
/* grf file related properties*/
uint8 local_id; ///< id defined by the grf file for this house

View File

@ -424,6 +424,7 @@ static void TileLoop_Town(TileIndex tile)
if (hs->building_flags & BUILDING_HAS_1_TILE &&
HASBIT(t->flags12, TOWN_IS_FUNDED) &&
CanDeleteHouse(tile) &&
max(_cur_year - GetHouseConstructionYear(tile), 0) >= hs->minimum_life &&
--t->time_until_rebuild == 0) {
t->time_until_rebuild = GB(r, 16, 8) + 192;