Add company setting to auto-enable auto timetables for new vehicles.

Default: off.
pull/3/head
Jonathan G Rennison 9 years ago
parent 25bc8eb1e2
commit 42370dc28d

@ -325,6 +325,8 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
v->vehicle_flags = 0;
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
v->SetServiceIntervalIsPercent(Company::Get(_current_company)->settings.vehicle.servint_ispercent);
SB(v->vehicle_flags, VF_AUTOMATE_TIMETABLE, 1,
_settings_game.order.timetable_automated && Company::Get(_current_company)->settings.vehicle.auto_timetable_by_default);
v->InvalidateNewGRFCacheOfChain();

@ -1478,6 +1478,8 @@ STR_CONFIG_SETTING_SERVINT_AIRCRAFT :Default service
STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT :Set the default service interval for new aircraft, if no explicit service interval is set for the vehicle
STR_CONFIG_SETTING_SERVINT_SHIPS :Default service interval for ships: {STRING2}
STR_CONFIG_SETTING_SERVINT_SHIPS_HELPTEXT :Set the default service interval for new ships, if no explicit service interval is set for the vehicle
STR_CONFIG_SETTING_AUTO_TIMETABLE_BY_DEFAULT :Use automatic timetables by default
STR_CONFIG_SETTING_AUTO_TIMETABLE_BY_DEFAULT_HELPTEXT :Choose whether automatic timetables should by automatically enabled for new vehicles
STR_CONFIG_SETTING_NOSERVICE :Disable servicing when breakdowns set to none: {STRING2}
STR_CONFIG_SETTING_NOSERVICE_HELPTEXT :When enabled, vehicles do not get serviced if they cannot break down
STR_CONFIG_SETTING_WAGONSPEEDLIMITS :Enable wagon speed limits: {STRING2}

@ -316,6 +316,8 @@ CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engin
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
v->SetServiceIntervalIsPercent(Company::Get(_current_company)->settings.vehicle.servint_ispercent);
SB(v->vehicle_flags, VF_AUTOMATE_TIMETABLE, 1,
_settings_game.order.timetable_automated && Company::Get(_current_company)->settings.vehicle.auto_timetable_by_default);
AddArticulatedParts(v);
v->InvalidateNewGRFCacheOfChain();

@ -311,6 +311,7 @@ static const SaveLoad _company_settings_desc[] = {
SLE_CONDVAR(Company, settings.vehicle.servint_roadveh, SLE_UINT16, 120, SL_MAX_VERSION),
SLE_CONDVAR(Company, settings.vehicle.servint_aircraft, SLE_UINT16, 120, SL_MAX_VERSION),
SLE_CONDVAR(Company, settings.vehicle.servint_ships, SLE_UINT16, 120, SL_MAX_VERSION),
SLE_CONDVAR_X(Company, settings.vehicle.auto_timetable_by_default, SLE_BOOL, 0, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AUTO_TIMETABLE, 2)),
SLE_CONDNULL(63, 2, 143), // old reserved space
@ -333,6 +334,7 @@ static const SaveLoad _company_settings_skip_desc[] = {
SLE_CONDNULL(2, 120, SL_MAX_VERSION), // settings.vehicle.servint_roadveh
SLE_CONDNULL(2, 120, SL_MAX_VERSION), // settings.vehicle.servint_aircraft
SLE_CONDNULL(2, 120, SL_MAX_VERSION), // settings.vehicle.servint_ships
SLE_CONDNULL_X(1, 0, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AUTO_TIMETABLE, 2)), // settings.vehicle.auto_timetable_by_default
SLE_CONDNULL(63, 2, 143), // old reserved space

@ -45,7 +45,7 @@ std::vector<uint32> _sl_xv_discardable_chunk_ids; ///< list of chunks
static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk
const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_AUTO_TIMETABLE, XSCF_NULL, 1, 1, "auto_timetables", NULL, NULL, NULL },
{ XSLFI_AUTO_TIMETABLE, XSCF_NULL, 2, 2, "auto_timetables", NULL, NULL, NULL },
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
};

@ -1586,6 +1586,7 @@ static SettingsContainer &GetSettingsTree()
company->Add(new SettingEntry("vehicle.servint_roadveh"));
company->Add(new SettingEntry("vehicle.servint_ships"));
company->Add(new SettingEntry("vehicle.servint_aircraft"));
company->Add(new SettingEntry("vehicle.auto_timetable_by_default"));
}
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));

@ -529,6 +529,7 @@ struct VehicleDefaultSettings {
uint16 servint_roadveh; ///< service interval for road vehicles
uint16 servint_aircraft; ///< service interval for aircraft
uint16 servint_ships; ///< service interval for ships
bool auto_timetable_by_default; ///< use automatic timetables by default
};
/** Settings that can be set per company. */

@ -717,6 +717,8 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, const Engine *e, u
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
v->SetServiceIntervalIsPercent(Company::Get(_current_company)->settings.vehicle.servint_ispercent);
SB(v->vehicle_flags, VF_AUTOMATE_TIMETABLE, 1,
_settings_game.order.timetable_automated && Company::Get(_current_company)->settings.vehicle.auto_timetable_by_default);
v->InvalidateNewGRFCacheOfChain();

@ -134,6 +134,14 @@ strhelp = STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT
strval = STR_CONFIG_SETTING_SERVINT_VALUE
proc = UpdateIntervalAircraft
[SDT_BOOL]
base = CompanySettings
var = vehicle.auto_timetable_by_default
guiflags = SGF_PER_COMPANY
def = false
str = STR_CONFIG_SETTING_AUTO_TIMETABLE_BY_DEFAULT
strhelp = STR_CONFIG_SETTING_AUTO_TIMETABLE_BY_DEFAULT_HELPTEXT
[SDT_END]

@ -775,6 +775,8 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, const Engin
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
v->SetServiceIntervalIsPercent(Company::Get(_current_company)->settings.vehicle.servint_ispercent);
SB(v->vehicle_flags, VF_AUTOMATE_TIMETABLE, 1,
_settings_game.order.timetable_automated && Company::Get(_current_company)->settings.vehicle.auto_timetable_by_default);
v->group_id = DEFAULT_GROUP;

Loading…
Cancel
Save