Add a company setting to control auto-fill timetable rounding.
This commit is contained in:
@@ -637,16 +637,18 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
|
||||
/* Before modifying waiting times, check whether we want to preserve bigger ones. */
|
||||
if (!real_current_order->IsType(OT_CONDITIONAL) &&
|
||||
(travelling || time_taken > real_current_order->GetWaitTime() || remeasure_wait_time)) {
|
||||
/* Round the time taken up to the nearest day, as this will avoid
|
||||
* confusion for people who are timetabling in days, and can be
|
||||
* adjusted later by people who aren't.
|
||||
/* Round the time taken up to the nearest timetable rounding factor
|
||||
* (default: day), as this will avoid confusion for people who are
|
||||
* timetabling in days, and can be adjusted later by people who aren't.
|
||||
* For trains/aircraft multiple movement cycles are done in one
|
||||
* tick. This makes it possible to leave the station and process
|
||||
* e.g. a depot order in the same tick, causing it to not fill
|
||||
* the timetable entry like is done for road vehicles/ships.
|
||||
* Thus always make sure at least one tick is used between the
|
||||
* processing of different orders when filling the timetable. */
|
||||
uint time_to_set = CeilDiv(max(time_taken, 1U), DAY_TICKS) * DAY_TICKS;
|
||||
Company *owner = Company::GetIfValid(v->owner);
|
||||
uint rounding_factor = owner ? owner->settings.timetable_autofill_rounding : DAY_TICKS;
|
||||
uint time_to_set = CeilDiv(max(time_taken, 1U), rounding_factor) * rounding_factor;
|
||||
|
||||
if (travelling && (autofilling || !real_current_order->IsTravelTimetabled())) {
|
||||
ChangeTimetable(v, v->cur_real_order_index, time_to_set, MTF_TRAVEL_TIME, autofilling);
|
||||
|
Reference in New Issue
Block a user