mirror of https://github.com/OpenTTD/OpenTTD
(svn r9823) -Feature: Add support for house property 1F - minimum life span.
parent
9643fd7638
commit
3cc31aae86
|
@ -1429,6 +1429,10 @@ static bool TownHouseChangeInfo(uint hid, int numinfo, int prop, byte **bufp, in
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x1F: // Minimum life span
|
||||||
|
FOR_EACH_OBJECT housespec[i]->minimum_life = grf_load_byte(&buf);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ret = true;
|
ret = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -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) \
|
#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, \
|
{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 */
|
/** House specifications from original data */
|
||||||
static const HouseSpec _original_house_specs[] = {
|
static const HouseSpec _original_house_specs[] = {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -164,10 +164,10 @@ struct HouseSpec {
|
||||||
CargoID accepts_cargo[3]; ///< 3 input cargo slots
|
CargoID accepts_cargo[3]; ///< 3 input cargo slots
|
||||||
BuildingFlags building_flags; ///< some flags that describe the house (size, stadium etc...)
|
BuildingFlags building_flags; ///< some flags that describe the house (size, stadium etc...)
|
||||||
HouseZones building_availability; ///< where can it be built (climates, zones)
|
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 */
|
/* 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
|
struct SpriteGroup *spritegroup; ///< pointer to the different sprites of the house
|
||||||
HouseID override; ///< which house this one replaces
|
HouseID override; ///< which house this one replaces
|
||||||
uint16 callback_mask; ///< House callback flags
|
uint16 callback_mask; ///< House callback flags
|
||||||
|
@ -178,6 +178,7 @@ struct HouseSpec {
|
||||||
byte animation_frames; ///< number of animation frames
|
byte animation_frames; ///< number of animation frames
|
||||||
byte animation_speed; ///< amount of time between each of those frames
|
byte animation_speed; ///< amount of time between each of those frames
|
||||||
byte processing_time; ///< Periodic refresh multiplier
|
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*/
|
/* grf file related properties*/
|
||||||
uint8 local_id; ///< id defined by the grf file for this house
|
uint8 local_id; ///< id defined by the grf file for this house
|
||||||
|
|
|
@ -424,6 +424,7 @@ static void TileLoop_Town(TileIndex tile)
|
||||||
if (hs->building_flags & BUILDING_HAS_1_TILE &&
|
if (hs->building_flags & BUILDING_HAS_1_TILE &&
|
||||||
HASBIT(t->flags12, TOWN_IS_FUNDED) &&
|
HASBIT(t->flags12, TOWN_IS_FUNDED) &&
|
||||||
CanDeleteHouse(tile) &&
|
CanDeleteHouse(tile) &&
|
||||||
|
max(_cur_year - GetHouseConstructionYear(tile), 0) >= hs->minimum_life &&
|
||||||
--t->time_until_rebuild == 0) {
|
--t->time_until_rebuild == 0) {
|
||||||
t->time_until_rebuild = GB(r, 16, 8) + 192;
|
t->time_until_rebuild = GB(r, 16, 8) + 192;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue