Scheduled dispatch: Add company setting to set default schedule duration
This commit is contained in:
@@ -492,6 +492,13 @@ STR_CONFIG_SETTING_TIMETABLE_AUTOFILL_ROUNDING_TICKS_VALUE :{COMMA}{NBSP}ti
|
|||||||
##default-translation STR_COLOUR_DEFAULT
|
##default-translation STR_COLOUR_DEFAULT
|
||||||
STR_CONFIG_SETTING_TIMETABLE_AUTOFILL_ROUNDING_TICKS_DEFAULT :Default
|
STR_CONFIG_SETTING_TIMETABLE_AUTOFILL_ROUNDING_TICKS_DEFAULT :Default
|
||||||
|
|
||||||
|
STR_CONFIG_SETTING_SCHEDULED_DISPATCH_DEFAULT_DURATION :Default duration for new dispatch schedules: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_SCHEDULED_DISPATCH_DEFAULT_DURATION_HELPTEXT :This sets the default duration for new dispatch schedules. The default is 24 hours (1440 minutes). (When timetabling in days the default is 1 year).
|
||||||
|
STR_CONFIG_SETTING_SCHEDULED_DISPATCH_DEFAULT_DURATION_VALUE :{COMMA}{NBSP}minute{P 0 "" s}
|
||||||
|
###setting-zero-is-special
|
||||||
|
##default-translation STR_COLOUR_DEFAULT
|
||||||
|
STR_CONFIG_SETTING_SCHEDULED_DISPATCH_DEFAULT_DURATION_DEFAULT :Default
|
||||||
|
|
||||||
STR_CONFIG_SETTING_DEFAULT_ROAD_TYPE :Default road/tram types (after new game/game load): {STRING2}
|
STR_CONFIG_SETTING_DEFAULT_ROAD_TYPE :Default road/tram types (after new game/game load): {STRING2}
|
||||||
STR_CONFIG_SETTING_DEFAULT_ROAD_TYPE_HELPTEXT :Road/tram types to select after starting or loading a game. 'first available' selects the oldest type of road/tram, 'last available' selects the newest type of road/tram, 'most used' selects the type which is currently most in use, and 'default' selects the default type
|
STR_CONFIG_SETTING_DEFAULT_ROAD_TYPE_HELPTEXT :Road/tram types to select after starting or loading a game. 'first available' selects the oldest type of road/tram, 'last available' selects the newest type of road/tram, 'most used' selects the type which is currently most in use, and 'default' selects the default type
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
#include "string_func.h"
|
#include "string_func.h"
|
||||||
#include "spritecache.h"
|
#include "spritecache.h"
|
||||||
#include "gfx_func.h"
|
#include "gfx_func.h"
|
||||||
|
#include "company_base.h"
|
||||||
#include "company_func.h"
|
#include "company_func.h"
|
||||||
#include "date_func.h"
|
#include "date_func.h"
|
||||||
#include "date_gui.h"
|
#include "date_gui.h"
|
||||||
@@ -160,7 +161,15 @@ static void AddNewScheduledDispatchSchedule(VehicleID vindex)
|
|||||||
DateTicksScaled start_tick;
|
DateTicksScaled start_tick;
|
||||||
uint32 duration;
|
uint32 duration;
|
||||||
|
|
||||||
if (_settings_time.time_in_minutes) {
|
const Company *c = Company::GetIfValid(_local_company);
|
||||||
|
if (c != nullptr && c->settings.default_sched_dispatch_duration != 0) {
|
||||||
|
/* Use duration from setting, set start time to be integer multiple of duration */
|
||||||
|
|
||||||
|
const TickMinutes now = _settings_time.NowInTickMinutes();
|
||||||
|
start_tick = _settings_time.FromTickMinutes(now - (now.base() % c->settings.default_sched_dispatch_duration));
|
||||||
|
|
||||||
|
duration = c->settings.default_sched_dispatch_duration * _settings_time.ticks_per_minute;
|
||||||
|
} else if (_settings_time.time_in_minutes) {
|
||||||
/* Set to 00:00 of today, and 1 day */
|
/* Set to 00:00 of today, and 1 day */
|
||||||
|
|
||||||
start_tick = _settings_time.FromTickMinutes(_settings_time.NowInTickMinutes().ToSameDayClockTime(0, 0));
|
start_tick = _settings_time.FromTickMinutes(_settings_time.NowInTickMinutes().ToSameDayClockTime(0, 0));
|
||||||
|
@@ -2200,6 +2200,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
company->Add(new SettingEntry("company.advance_order_on_clone"));
|
company->Add(new SettingEntry("company.advance_order_on_clone"));
|
||||||
company->Add(new SettingEntry("company.copy_clone_add_to_group"));
|
company->Add(new SettingEntry("company.copy_clone_add_to_group"));
|
||||||
company->Add(new SettingEntry("company.remain_if_next_order_same_station"));
|
company->Add(new SettingEntry("company.remain_if_next_order_same_station"));
|
||||||
|
company->Add(new SettingEntry("company.default_sched_dispatch_duration"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
|
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
|
||||||
|
@@ -834,6 +834,7 @@ struct CompanySettings {
|
|||||||
bool advance_order_on_clone; ///< when cloning a vehicle or copying/sharing an order list, advance the current order to a suitable point
|
bool advance_order_on_clone; ///< when cloning a vehicle or copying/sharing an order list, advance the current order to a suitable point
|
||||||
bool copy_clone_add_to_group; ///< whether to add cloned vehicles to the source vehicle's group, when cloning a vehicle without sharing orders
|
bool copy_clone_add_to_group; ///< whether to add cloned vehicles to the source vehicle's group, when cloning a vehicle without sharing orders
|
||||||
bool remain_if_next_order_same_station; ///< if the next order is for the same station, start loading/unloading again instead of leaving.
|
bool remain_if_next_order_same_station; ///< if the next order is for the same station, start loading/unloading again instead of leaving.
|
||||||
|
uint16 default_sched_dispatch_duration; ///< default scheduled dispatch duration
|
||||||
|
|
||||||
byte old_simulated_wormhole_signals; ///< no longer needs a setting: tunnel/bridge signal simulation spacing
|
byte old_simulated_wormhole_signals; ///< no longer needs a setting: tunnel/bridge signal simulation spacing
|
||||||
};
|
};
|
||||||
|
@@ -266,6 +266,21 @@ str = STR_CONFIG_SETTING_REMAIN_IF_NEXT_ORDER_SAME_STATION
|
|||||||
strhelp = STR_CONFIG_SETTING_REMAIN_IF_NEXT_ORDER_SAME_STATION_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_REMAIN_IF_NEXT_ORDER_SAME_STATION_HELPTEXT
|
||||||
patxname = ""remain_if_next_order_same_station""
|
patxname = ""remain_if_next_order_same_station""
|
||||||
|
|
||||||
|
[SDT_VAR]
|
||||||
|
base = CompanySettings
|
||||||
|
var = default_sched_dispatch_duration
|
||||||
|
type = SLE_UINT16
|
||||||
|
flags = SF_PER_COMPANY | SF_GUI_0_IS_SPECIAL | SF_PATCH
|
||||||
|
def = 0
|
||||||
|
min = 0
|
||||||
|
max = 10080
|
||||||
|
interval = 30
|
||||||
|
str = STR_CONFIG_SETTING_SCHEDULED_DISPATCH_DEFAULT_DURATION
|
||||||
|
strhelp = STR_CONFIG_SETTING_SCHEDULED_DISPATCH_DEFAULT_DURATION_HELPTEXT
|
||||||
|
strval = STR_CONFIG_SETTING_SCHEDULED_DISPATCH_DEFAULT_DURATION_VALUE
|
||||||
|
cat = SC_ADVANCED
|
||||||
|
patxname = ""default_sched_dispatch_duration""
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = CompanySettings
|
base = CompanySettings
|
||||||
var = old_simulated_wormhole_signals
|
var = old_simulated_wormhole_signals
|
||||||
|
Reference in New Issue
Block a user