Add setting to disable object expiry after a given year

pull/393/head
Jonathan G Rennison 2 years ago
parent 30f74c5b74
commit 6fce46304a

@ -2471,6 +2471,11 @@ STR_CONFIG_SETTING_PURCHASE_LAND_PERMITTED_HELPTEXT :Set whether com
STR_CONFIG_SETTING_BUILD_OBJECT_PERMITTED :Permit bulk construction of objects: {STRING2}
STR_CONFIG_SETTING_BUILD_OBJECT_PERMITTED_HELPTEXT :Set whether companies are permitted to construct objects by area, instead of one at a time
STR_CONFIG_SETTING_NO_EXPIRE_OBJECTS_AFTER :No objects expire after: {STRING2}
STR_CONFIG_SETTING_NO_EXPIRE_OBJECTS_AFTER_HELPTEXT :Objects which would otherwise expire after this year remain available forever
STR_CONFIG_SETTING_NO_EXPIRE_OBJECTS_AFTER_VALUE :{NUM}
STR_CONFIG_SETTING_NO_EXPIRE_OBJECTS_AFTER_ZERO :Off
STR_PURCHASE_LAND_PERMITTED_NO :No
STR_PURCHASE_LAND_PERMITTED_SINGLE :Yes, 1 tile at a time
STR_PURCHASE_LAND_PERMITTED_AREA :Yes, large areas at a time

@ -80,7 +80,8 @@ bool ObjectSpec::WasEverAvailable() const
bool ObjectSpec::IsAvailable() const
{
return this->WasEverAvailable() &&
(_date < this->end_of_life_date || this->end_of_life_date < this->introduction_date + 365);
(_date < this->end_of_life_date || this->end_of_life_date < this->introduction_date + 365 ||
(_settings_game.construction.no_expire_objects_after != 0 && _cur_year >= _settings_game.construction.no_expire_objects_after));
}
/**

@ -2088,6 +2088,7 @@ static SettingsContainer &GetSettingsTree()
limitations->Add(new SettingEntry("construction.allow_docks_under_bridges"));
limitations->Add(new SettingEntry("construction.purchase_land_permitted"));
limitations->Add(new SettingEntry("construction.build_object_area_permitted"));
limitations->Add(new SettingEntry("construction.no_expire_objects_after"));
}
SettingsPage *disasters = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCIDENTS));

@ -454,6 +454,7 @@ struct ConstructionSettings {
bool allow_docks_under_bridges; ///< allow docks under bridges
byte purchase_land_permitted; ///< whether and how purchasing land is permitted
bool build_object_area_permitted; ///< whether building objects by area is permitted
Year no_expire_objects_after; ///< do not expire objects after this year
uint32 terraform_per_64k_frames; ///< how many tile heights may, over a long period, be terraformed per 65536 frames?
uint16 terraform_frame_burst; ///< how many tile heights may, over a short period, be terraformed?
@ -615,8 +616,8 @@ struct VehicleSettings {
uint8 freight_trains; ///< value to multiply the weight of cargo by
bool dynamic_engines; ///< enable dynamic allocation of engine data
bool never_expire_vehicles; ///< never expire vehicles
Year no_expire_vehicles_after; ///< do not expire vehicles ater this year
Year no_introduce_vehicles_after; ///< do not introduce vehicles ater this year
Year no_expire_vehicles_after; ///< do not expire vehicles after this year
Year no_introduce_vehicles_after; ///< do not introduce vehicles after this year
byte extend_vehicle_life; ///< extend vehicle life by this many years
byte road_side; ///< the side of the road vehicles drive on
uint8 plane_crashes; ///< number of plane crashes, 0 = none, 1 = reduced, 2 = normal

@ -2078,6 +2078,21 @@ str = STR_CONFIG_SETTING_BUILD_OBJECT_PERMITTED
strhelp = STR_CONFIG_SETTING_BUILD_OBJECT_PERMITTED_HELPTEXT
patxname = ""build_object_area_permitted.construction.build_object_area_permitted""
[SDT_VAR]
var = construction.no_expire_objects_after
type = SLE_INT32
flags = SF_GUI_0_IS_SPECIAL
def = 0
min = MIN_YEAR
max = MAX_YEAR
interval = 1
str = STR_CONFIG_SETTING_NO_EXPIRE_OBJECTS_AFTER
strhelp = STR_CONFIG_SETTING_NO_EXPIRE_OBJECTS_AFTER_HELPTEXT
strval = STR_CONFIG_SETTING_NO_EXPIRE_OBJECTS_AFTER_VALUE
cat = SC_ADVANCED
patxname = ""construction.no_expire_objects_after""
post_cb = [](auto) { InvalidateWindowClassesData(WC_BUILD_OBJECT, 0); }
[SDT_BOOL]
var = station.adjacent_stations
from = SLV_62

Loading…
Cancel
Save