Add setting for departure boards duration when using minutes
Default to 24 hours
This commit is contained in:
@@ -239,7 +239,7 @@ DepartureList* MakeDepartureList(StationID station, const std::vector<const Vehi
|
|||||||
std::vector<OrderDate*> next_orders;
|
std::vector<OrderDate*> next_orders;
|
||||||
|
|
||||||
/* The maximum possible date for departures to be scheduled to occur. */
|
/* The maximum possible date for departures to be scheduled to occur. */
|
||||||
DateTicksScaled max_date = _settings_client.gui.max_departure_time * DAY_TICKS * _settings_game.economy.day_length_factor;
|
DateTicksScaled max_date = GetDeparturesMaxTicksAhead();
|
||||||
|
|
||||||
DateTicksScaled date_only_scaled = DateToScaledDateTicks(_date);
|
DateTicksScaled date_only_scaled = DateToScaledDateTicks(_date);
|
||||||
DateTicksScaled date_fract_scaled = ((DateTicksScaled)_date_fract * _settings_game.economy.day_length_factor) + _tick_skip_counter;
|
DateTicksScaled date_fract_scaled = ((DateTicksScaled)_date_fract * _settings_game.economy.day_length_factor) + _tick_skip_counter;
|
||||||
@@ -865,3 +865,12 @@ DepartureList* MakeDepartureList(StationID station, const std::vector<const Vehi
|
|||||||
/* Done. Phew! */
|
/* Done. Phew! */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DateTicksScaled GetDeparturesMaxTicksAhead()
|
||||||
|
{
|
||||||
|
if (_settings_time.time_in_minutes) {
|
||||||
|
return _settings_client.gui.max_departure_time_minutes * _settings_time.ticks_per_minute;
|
||||||
|
} else {
|
||||||
|
return _settings_client.gui.max_departure_time * DAY_TICKS * _settings_game.economy.day_length_factor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -21,4 +21,6 @@
|
|||||||
DepartureList* MakeDepartureList(StationID station, const std::vector<const Vehicle *> &vehicles, DepartureType type = D_DEPARTURE,
|
DepartureList* MakeDepartureList(StationID station, const std::vector<const Vehicle *> &vehicles, DepartureType type = D_DEPARTURE,
|
||||||
bool show_vehicles_via = false, bool show_pax = true, bool show_freight = true);
|
bool show_vehicles_via = false, bool show_pax = true, bool show_freight = true);
|
||||||
|
|
||||||
|
DateTicksScaled GetDeparturesMaxTicksAhead();
|
||||||
|
|
||||||
#endif /* DEPARTURES_FUNC_H */
|
#endif /* DEPARTURES_FUNC_H */
|
||||||
|
@@ -748,7 +748,7 @@ void DeparturesWindow<Twaypoint>::DrawDeparturesListItems(const Rect &r) const
|
|||||||
uint arrival = 0;
|
uint arrival = 0;
|
||||||
|
|
||||||
DateTicksScaled now_date = _scaled_date_ticks;
|
DateTicksScaled now_date = _scaled_date_ticks;
|
||||||
DateTicksScaled max_date = now_date + (_settings_client.gui.max_departure_time * DAY_TICKS * _settings_game.economy.day_length_factor);
|
DateTicksScaled max_date = now_date + GetDeparturesMaxTicksAhead();
|
||||||
|
|
||||||
/* Draw each departure. */
|
/* Draw each departure. */
|
||||||
for (uint i = 0; i < max_departures; ++i) {
|
for (uint i = 0; i < max_departures; ++i) {
|
||||||
|
@@ -1347,6 +1347,8 @@ STR_CONFIG_MAX_DEPARTURES :Show at most {S
|
|||||||
STR_CONFIG_MAX_DEPARTURES_HELPTEXT :The maximum number of entries to show on a departure board
|
STR_CONFIG_MAX_DEPARTURES_HELPTEXT :The maximum number of entries to show on a departure board
|
||||||
STR_CONFIG_MAX_DEPARTURE_TIME :Show arrivals/departures at most {STRING2} days in advance
|
STR_CONFIG_MAX_DEPARTURE_TIME :Show arrivals/departures at most {STRING2} days in advance
|
||||||
STR_CONFIG_MAX_DEPARTURE_TIME_HELPTEXT :How far in advance to show arrivals and departures, in days
|
STR_CONFIG_MAX_DEPARTURE_TIME_HELPTEXT :How far in advance to show arrivals and departures, in days
|
||||||
|
STR_CONFIG_MAX_DEPARTURE_TIME_MINUTES :Show arrivals/departures at most {STRING2} minutes in advance
|
||||||
|
STR_CONFIG_MAX_DEPARTURE_TIME_MINUTES_HELPTEXT :How far in advance to show arrivals and departures, in minutes
|
||||||
STR_CONFIG_DEPARTURE_CALC_FREQUENCY :Calculate departure board entries every {STRING2} ticks
|
STR_CONFIG_DEPARTURE_CALC_FREQUENCY :Calculate departure board entries every {STRING2} ticks
|
||||||
STR_CONFIG_DEPARTURE_CALC_FREQUENCY_HELPTEXT :How frequently to refresh a list of arrivals/departures, in ticks
|
STR_CONFIG_DEPARTURE_CALC_FREQUENCY_HELPTEXT :How frequently to refresh a list of arrivals/departures, in ticks
|
||||||
STR_CONFIG_DEPARTURE_VEHICLE_NAME :Show vehicle name in entries: {STRING2}
|
STR_CONFIG_DEPARTURE_VEHICLE_NAME :Show vehicle name in entries: {STRING2}
|
||||||
|
@@ -1272,6 +1272,8 @@ static void UpdateTimeSettings(int32 new_value)
|
|||||||
SetupTimeSettings();
|
SetupTimeSettings();
|
||||||
InvalidateVehTimetableWindow(new_value);
|
InvalidateVehTimetableWindow(new_value);
|
||||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_REINIT);
|
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_REINIT);
|
||||||
|
InvalidateWindowClassesData(WC_GAME_OPTIONS);
|
||||||
|
InvalidateWindowClassesData(WC_DEPARTURES_BOARD, 1);
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2011,7 +2011,8 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
SettingsPage *departureboards = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS));
|
SettingsPage *departureboards = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS));
|
||||||
{
|
{
|
||||||
departureboards->Add(new SettingEntry("gui.max_departures"));
|
departureboards->Add(new SettingEntry("gui.max_departures"));
|
||||||
departureboards->Add(new SettingEntry("gui.max_departure_time"));
|
departureboards->Add(new ConditionallyHiddenSettingEntry("gui.max_departure_time", []() -> bool { return _settings_time.time_in_minutes; }));
|
||||||
|
departureboards->Add(new ConditionallyHiddenSettingEntry("gui.max_departure_time_minutes", []() -> bool { return !_settings_time.time_in_minutes; }));
|
||||||
departureboards->Add(new SettingEntry("gui.departure_calc_frequency"));
|
departureboards->Add(new SettingEntry("gui.departure_calc_frequency"));
|
||||||
departureboards->Add(new SettingEntry("gui.departure_show_vehicle"));
|
departureboards->Add(new SettingEntry("gui.departure_show_vehicle"));
|
||||||
departureboards->Add(new SettingEntry("gui.departure_show_group"));
|
departureboards->Add(new SettingEntry("gui.departure_show_group"));
|
||||||
|
@@ -174,7 +174,8 @@ struct GUISettings : public TimeSettings {
|
|||||||
bool use_owner_colour_for_tunnelbridge;///< bridges and tunnels are rendered with their owner's colour
|
bool use_owner_colour_for_tunnelbridge;///< bridges and tunnels are rendered with their owner's colour
|
||||||
bool timetable_arrival_departure; ///< show arrivals and departures in vehicle timetables
|
bool timetable_arrival_departure; ///< show arrivals and departures in vehicle timetables
|
||||||
uint8 max_departures; ///< maximum number of departures to show per station
|
uint8 max_departures; ///< maximum number of departures to show per station
|
||||||
uint16 max_departure_time; ///< maximum time in advance to show departures
|
uint16 max_departure_time; ///< maximum time in advance to show departures (days)
|
||||||
|
uint16 max_departure_time_minutes; ///< maximum time in advance to show departures (minutes)
|
||||||
uint16 departure_calc_frequency; ///< how often to calculate departures (in ticks)
|
uint16 departure_calc_frequency; ///< how often to calculate departures (in ticks)
|
||||||
bool departure_show_vehicle; ///< whether to show vehicle names with departures
|
bool departure_show_vehicle; ///< whether to show vehicle names with departures
|
||||||
bool departure_show_group; ///< whether to show group names with departures
|
bool departure_show_group; ///< whether to show group names with departures
|
||||||
|
@@ -5013,15 +5013,28 @@ post_cb = [](auto) { InvalidateWindowClassesData(WC_DEPARTURES_BOARD, 1); }
|
|||||||
var = gui.max_departure_time
|
var = gui.max_departure_time
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
||||||
strval = STR_JUST_INT
|
strval = STR_JUST_COMMA
|
||||||
def = 120
|
def = 120
|
||||||
min = 30
|
min = 30
|
||||||
max = 240
|
max = 365
|
||||||
interval = 1
|
interval = 1
|
||||||
str = STR_CONFIG_MAX_DEPARTURE_TIME
|
str = STR_CONFIG_MAX_DEPARTURE_TIME
|
||||||
strhelp = STR_CONFIG_MAX_DEPARTURE_TIME_HELPTEXT
|
strhelp = STR_CONFIG_MAX_DEPARTURE_TIME_HELPTEXT
|
||||||
post_cb = [](auto) { InvalidateWindowClassesData(WC_DEPARTURES_BOARD, 1); }
|
post_cb = [](auto) { InvalidateWindowClassesData(WC_DEPARTURES_BOARD, 1); }
|
||||||
|
|
||||||
|
[SDTC_VAR]
|
||||||
|
var = gui.max_departure_time_minutes
|
||||||
|
type = SLE_UINT16
|
||||||
|
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
||||||
|
strval = STR_JUST_COMMA
|
||||||
|
def = 1440
|
||||||
|
min = 30
|
||||||
|
max = 5000
|
||||||
|
interval = 30
|
||||||
|
str = STR_CONFIG_MAX_DEPARTURE_TIME_MINUTES
|
||||||
|
strhelp = STR_CONFIG_MAX_DEPARTURE_TIME_MINUTES_HELPTEXT
|
||||||
|
post_cb = [](auto) { InvalidateWindowClassesData(WC_DEPARTURES_BOARD, 1); }
|
||||||
|
|
||||||
[SDTC_VAR]
|
[SDTC_VAR]
|
||||||
var = gui.departure_calc_frequency
|
var = gui.departure_calc_frequency
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
|
Reference in New Issue
Block a user