mirror of https://github.com/OpenTTD/OpenTTD
Add vehicle preview offer setting and update vehicle introduction logic
parent
b57f3262ec
commit
1d6aee07d6
|
@ -966,6 +966,7 @@ static IntervalTimer<TimerGameCalendar> _calendar_engines_daily({TimerGameCalend
|
|||
c->avail_roadtypes = AddDateIntroducedRoadTypes(c->avail_roadtypes, TimerGameCalendar::date);
|
||||
}
|
||||
|
||||
if (!_settings_game.vehicle.offer_vehicle_preview) return;
|
||||
if (TimerGameCalendar::year >= _year_engine_aging_stops) return;
|
||||
|
||||
for (Engine *e : Engine::Iterate()) {
|
||||
|
@ -1160,7 +1161,7 @@ void CalendarEnginesMonthlyLoop()
|
|||
/* Do not introduce invalid engines */
|
||||
if (!e->IsEnabled()) continue;
|
||||
|
||||
if (!e->flags.Test(EngineFlag::Available) && TimerGameCalendar::date >= (e->intro_date + CalendarTime::DAYS_IN_YEAR)) {
|
||||
if (!e->flags.Test(EngineFlag::Available) && TimerGameCalendar::date >= (e->intro_date + (_settings_game.vehicle.offer_vehicle_preview ? CalendarTime::DAYS_IN_YEAR : 0))) {
|
||||
/* Introduce it to all companies */
|
||||
NewVehicleAvailable(e);
|
||||
} else if (!e->flags.Any({EngineFlag::Available, EngineFlag::ExclusivePreview}) && TimerGameCalendar::date >= e->intro_date) {
|
||||
|
|
|
@ -1508,6 +1508,9 @@ STR_CONFIG_SETTING_WARN_OLD_VEHICLE_HELPTEXT :When enabled, a
|
|||
STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES :Vehicles never expire: {STRING2}
|
||||
STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES_HELPTEXT :When enabled, all vehicle models remain available forever after their introduction
|
||||
|
||||
STR_CONFIG_SETTING_OFFER_VEHICLE_PREVIEW :Show vehicle previews: {STRING2}
|
||||
STR_CONFIG_SETTING_OFFER_VEHICLE_PREVIEW_HELPTEXT :When enabled, the top performing company is sometimes offered a 1 year exclusive preview of a vehicle
|
||||
|
||||
STR_CONFIG_SETTING_TIMEKEEPING_UNITS :Timekeeping: {STRING2}
|
||||
STR_CONFIG_SETTING_TIMEKEEPING_UNITS_HELPTEXT :Select the timekeeping units of the game. This cannot be changed later.{}{}Calendar-based is the classic OpenTTD experience, with a year consisting of 12 months, and each month having 28-31 days.{}{}In Wallclock-based time, cargo production and financials are instead based on one-minute increments, which is about as long as a 30 day month takes in Calendar-based mode. These are grouped into 12-minute periods, equivalent to a year in Calendar-based mode.{}{}In either mode there is always a classic calendar, which is used for introduction dates of vehicles, houses, and other infrastructure
|
||||
###length 2
|
||||
|
|
|
@ -820,6 +820,7 @@ SettingsContainer &GetSettingsTree()
|
|||
limitations->Add(new SettingEntry("construction.max_tunnel_length"));
|
||||
limitations->Add(new SettingEntry("station.never_expire_airports"));
|
||||
limitations->Add(new SettingEntry("vehicle.never_expire_vehicles"));
|
||||
limitations->Add(new SettingEntry("vehicle.offer_vehicle_preview"));
|
||||
limitations->Add(new SettingEntry("vehicle.max_trains"));
|
||||
limitations->Add(new SettingEntry("vehicle.max_roadveh"));
|
||||
limitations->Add(new SettingEntry("vehicle.max_aircraft"));
|
||||
|
|
|
@ -511,6 +511,7 @@ struct VehicleSettings {
|
|||
uint8_t 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
|
||||
bool offer_vehicle_preview; ///< offer vehicle preview to companies
|
||||
uint8_t extend_vehicle_life; ///< extend vehicle life by this many years
|
||||
uint8_t road_side; ///< the side of the road vehicles drive on
|
||||
uint8_t plane_crashes; ///< number of plane crashes, 0 = none, 1 = reduced, 2 = normal
|
||||
|
|
|
@ -241,6 +241,13 @@ def = false
|
|||
str = STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES
|
||||
strhelp = STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES_HELPTEXT
|
||||
|
||||
[SDT_BOOL]
|
||||
var = vehicle.offer_vehicle_preview
|
||||
flags = SettingFlag::NoNetwork
|
||||
def = true
|
||||
str = STR_CONFIG_SETTING_OFFER_VEHICLE_PREVIEW
|
||||
strhelp = STR_CONFIG_SETTING_OFFER_VEHICLE_PREVIEW_HELPTEXT
|
||||
|
||||
[SDT_VAR]
|
||||
var = vehicle.max_trains
|
||||
type = SLE_UINT16
|
||||
|
|
Loading…
Reference in New Issue