mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
4 Commits
051abb2fad
...
dc27f1649a
Author | SHA1 | Date |
---|---|---|
|
dc27f1649a | |
|
162ffc288d | |
|
2bada59193 | |
|
2a62caa30b |
|
@ -18,8 +18,8 @@ struct BaseConsist {
|
||||||
std::string name; ///< Name of vehicle
|
std::string name; ///< Name of vehicle
|
||||||
|
|
||||||
/* Used for timetabling. */
|
/* Used for timetabling. */
|
||||||
uint32_t current_order_time; ///< How many ticks have passed since this order started.
|
TimerGameTick::Ticks current_order_time; ///< How many ticks have passed since this order started.
|
||||||
int32_t lateness_counter; ///< How many ticks late (or early if negative) this vehicle is.
|
TimerGameTick::Ticks lateness_counter; ///< How many ticks late (or early if negative) this vehicle is.
|
||||||
TimerGameTick::TickCounter timetable_start; ///< At what tick of TimerGameTick::counter the vehicle should start its timetable.
|
TimerGameTick::TickCounter timetable_start; ///< At what tick of TimerGameTick::counter the vehicle should start its timetable.
|
||||||
|
|
||||||
uint16_t service_interval; ///< The interval for (automatic) servicing; either in days or %.
|
uint16_t service_interval; ///< The interval for (automatic) servicing; either in days or %.
|
||||||
|
|
|
@ -1872,7 +1872,7 @@ static void LoadUnloadVehicle(Vehicle *front)
|
||||||
/* We loaded less cargo than possible for all cargo types and it's not full
|
/* We loaded less cargo than possible for all cargo types and it's not full
|
||||||
* load and we're not supposed to wait any longer: stop loading. */
|
* load and we're not supposed to wait any longer: stop loading. */
|
||||||
if (!anything_unloaded && full_load_amount == 0 && reservation_left == 0 && !(front->current_order.GetLoadType() & OLFB_FULL_LOAD) &&
|
if (!anything_unloaded && full_load_amount == 0 && reservation_left == 0 && !(front->current_order.GetLoadType() & OLFB_FULL_LOAD) &&
|
||||||
front->current_order_time >= (uint)std::max(front->current_order.GetTimetabledWait() - front->lateness_counter, 0)) {
|
front->current_order_time >= std::max(front->current_order.GetTimetabledWait() - front->lateness_counter, 0)) {
|
||||||
SetBit(front->vehicle_flags, VF_STOP_LOADING);
|
SetBit(front->vehicle_flags, VF_STOP_LOADING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1980,7 +1980,7 @@ bool AdjustGUIZoom(bool automatic)
|
||||||
ZoomLevel old_font_zoom = _font_zoom;
|
ZoomLevel old_font_zoom = _font_zoom;
|
||||||
int old_scale = _gui_scale;
|
int old_scale = _gui_scale;
|
||||||
UpdateGUIZoom();
|
UpdateGUIZoom();
|
||||||
if (old_scale == _gui_scale) return false;
|
if (old_scale == _gui_scale && old_gui_zoom == _gui_zoom) return false;
|
||||||
|
|
||||||
/* Reload sprites if sprite zoom level has changed. */
|
/* Reload sprites if sprite zoom level has changed. */
|
||||||
if (old_gui_zoom != _gui_zoom) {
|
if (old_gui_zoom != _gui_zoom) {
|
||||||
|
|
|
@ -255,6 +255,10 @@ STR_UNITS_HEIGHT_IMPERIAL :{DECIMAL}{NBSP}
|
||||||
STR_UNITS_HEIGHT_METRIC :{DECIMAL}{NBSP}m
|
STR_UNITS_HEIGHT_METRIC :{DECIMAL}{NBSP}m
|
||||||
STR_UNITS_HEIGHT_SI :{DECIMAL}{NBSP}m
|
STR_UNITS_HEIGHT_SI :{DECIMAL}{NBSP}m
|
||||||
|
|
||||||
|
STR_UNITS_DAYS :{COMMA}{NBSP}day{P "" s}
|
||||||
|
STR_UNITS_SECONDS :{COMMA}{NBSP}second{P "" s}
|
||||||
|
STR_UNITS_TICKS :{COMMA}{NBSP}tick{P "" s}
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
||||||
STR_LIST_FILTER_OSKTITLE :{BLACK}Enter one or more keywords to filter the list for
|
STR_LIST_FILTER_OSKTITLE :{BLACK}Enter one or more keywords to filter the list for
|
||||||
|
@ -1655,8 +1659,12 @@ STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS_HELPTEXT :Enable usage of
|
||||||
STR_CONFIG_SETTING_LOADING_INDICATORS :Use loading indicators: {STRING2}
|
STR_CONFIG_SETTING_LOADING_INDICATORS :Use loading indicators: {STRING2}
|
||||||
STR_CONFIG_SETTING_LOADING_INDICATORS_HELPTEXT :Select whether loading indicators are displayed above loading or unloading vehicles
|
STR_CONFIG_SETTING_LOADING_INDICATORS_HELPTEXT :Select whether loading indicators are displayed above loading or unloading vehicles
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS :Show timetable in ticks rather than days: {STRING2}
|
STR_CONFIG_SETTING_TIMETABLE_MODE :Time units for timetables: {STRING2}
|
||||||
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS_HELPTEXT :Show travel times in time tables in game ticks instead of days
|
STR_CONFIG_SETTING_TIMETABLE_MODE_HELPTEXT :Select the time units used for vehicle timetables
|
||||||
|
###length 3
|
||||||
|
STR_CONFIG_SETTING_TIMETABLE_MODE_DAYS :Days
|
||||||
|
STR_CONFIG_SETTING_TIMETABLE_MODE_SECONDS :Seconds
|
||||||
|
STR_CONFIG_SETTING_TIMETABLE_MODE_TICKS :Ticks
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE :Show arrival and departure in timetables: {STRING2}
|
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE :Show arrival and departure in timetables: {STRING2}
|
||||||
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE_HELPTEXT :Display anticipated arrival and departure times in timetables
|
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE_HELPTEXT :Display anticipated arrival and departure times in timetables
|
||||||
|
@ -4565,8 +4573,6 @@ STR_TIMETABLE_STAY_FOR_ESTIMATED :(stay for {STRI
|
||||||
STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED :(travel for {STRING1}, not timetabled)
|
STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED :(travel for {STRING1}, not timetabled)
|
||||||
STR_TIMETABLE_STAY_FOR :and stay for {STRING1}
|
STR_TIMETABLE_STAY_FOR :and stay for {STRING1}
|
||||||
STR_TIMETABLE_AND_TRAVEL_FOR :and travel for {STRING1}
|
STR_TIMETABLE_AND_TRAVEL_FOR :and travel for {STRING1}
|
||||||
STR_TIMETABLE_DAYS :{COMMA}{NBSP}day{P "" s}
|
|
||||||
STR_TIMETABLE_TICKS :{COMMA}{NBSP}tick{P "" s}
|
|
||||||
|
|
||||||
STR_TIMETABLE_TOTAL_TIME :{BLACK}This timetable will take {STRING1} to complete
|
STR_TIMETABLE_TOTAL_TIME :{BLACK}This timetable will take {STRING1} to complete
|
||||||
STR_TIMETABLE_TOTAL_TIME_INCOMPLETE :{BLACK}This timetable will take at least {STRING1} to complete (not all timetabled)
|
STR_TIMETABLE_TOTAL_TIME_INCOMPLETE :{BLACK}This timetable will take at least {STRING1} to complete (not all timetabled)
|
||||||
|
@ -4575,10 +4581,13 @@ STR_TIMETABLE_STATUS_ON_TIME :{BLACK}This veh
|
||||||
STR_TIMETABLE_STATUS_LATE :{BLACK}This vehicle is currently running {STRING1} late
|
STR_TIMETABLE_STATUS_LATE :{BLACK}This vehicle is currently running {STRING1} late
|
||||||
STR_TIMETABLE_STATUS_EARLY :{BLACK}This vehicle is currently running {STRING1} early
|
STR_TIMETABLE_STATUS_EARLY :{BLACK}This vehicle is currently running {STRING1} early
|
||||||
STR_TIMETABLE_STATUS_NOT_STARTED :{BLACK}This timetable has not yet started
|
STR_TIMETABLE_STATUS_NOT_STARTED :{BLACK}This timetable has not yet started
|
||||||
STR_TIMETABLE_STATUS_START_AT :{BLACK}This timetable will start at {STRING1}
|
STR_TIMETABLE_STATUS_START_AT_DATE :{BLACK}This timetable will start at {STRING1}
|
||||||
|
STR_TIMETABLE_STATUS_START_IN_SECONDS :{BLACK}This timetable will start in {COMMA} seconds
|
||||||
|
|
||||||
STR_TIMETABLE_STARTING_DATE :{BLACK}Start date
|
STR_TIMETABLE_START :{BLACK}Start Timetable
|
||||||
STR_TIMETABLE_STARTING_DATE_TOOLTIP :{BLACK}Select a date as starting point of this timetable. Ctrl+Click distributes all vehicles sharing this order evenly from the given date based on their relative order, if the order is completely timetabled
|
STR_TIMETABLE_START_TOOLTIP :{BLACK}Select when this timetable starts. Ctrl+Click evenly distributes the start of all vehicles sharing this order based on their relative order, if the order is completely timetabled
|
||||||
|
|
||||||
|
STR_TIMETABLE_START_SECONDS_QUERY :Seconds until timetable starts
|
||||||
|
|
||||||
STR_TIMETABLE_CHANGE_TIME :{BLACK}Change Time
|
STR_TIMETABLE_CHANGE_TIME :{BLACK}Change Time
|
||||||
STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Change the amount of time that the highlighted order should take. Ctrl+Click sets the time for all orders
|
STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Change the amount of time that the highlighted order should take. Ctrl+Click sets the time for all orders
|
||||||
|
@ -4602,8 +4611,10 @@ STR_TIMETABLE_EXPECTED :{BLACK}Expected
|
||||||
STR_TIMETABLE_SCHEDULED :{BLACK}Scheduled
|
STR_TIMETABLE_SCHEDULED :{BLACK}Scheduled
|
||||||
STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Switch between expected and scheduled
|
STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}Switch between expected and scheduled
|
||||||
|
|
||||||
STR_TIMETABLE_ARRIVAL :A: {COLOUR}{DATE_TINY}
|
STR_TIMETABLE_ARRIVAL_DATE :A: {COLOUR}{DATE_TINY}
|
||||||
STR_TIMETABLE_DEPARTURE :D: {COLOUR}{DATE_TINY}
|
STR_TIMETABLE_DEPARTURE_DATE :D: {COLOUR}{DATE_TINY}
|
||||||
|
STR_TIMETABLE_ARRIVAL_SECONDS_IN_FUTURE :A: {COLOUR}{COMMA} sec
|
||||||
|
STR_TIMETABLE_DEPARTURE_SECONDS_IN_FUTURE :D: {COLOUR}{COMMA} sec
|
||||||
|
|
||||||
|
|
||||||
# Date window (for timetable)
|
# Date window (for timetable)
|
||||||
|
|
|
@ -233,8 +233,7 @@ void LinkRefresher::RefreshStats(const Order *cur, const Order *next)
|
||||||
* probably far off and we'd greatly overestimate the capacity by increasing.*/
|
* probably far off and we'd greatly overestimate the capacity by increasing.*/
|
||||||
if (this->is_full_loading && this->vehicle->orders != nullptr &&
|
if (this->is_full_loading && this->vehicle->orders != nullptr &&
|
||||||
st->index == vehicle->last_station_visited &&
|
st->index == vehicle->last_station_visited &&
|
||||||
this->vehicle->orders->GetTotalDuration() >
|
this->vehicle->orders->GetTotalDuration() > this->vehicle->current_order_time) {
|
||||||
(TimerGameTick::Ticks)this->vehicle->current_order_time) {
|
|
||||||
uint effective_capacity = cargo_quantity * this->vehicle->load_unload_ticks;
|
uint effective_capacity = cargo_quantity * this->vehicle->load_unload_ticks;
|
||||||
if (effective_capacity > (uint)this->vehicle->orders->GetTotalDuration()) {
|
if (effective_capacity > (uint)this->vehicle->orders->GetTotalDuration()) {
|
||||||
IncreaseStats(st, c, next_station, effective_capacity /
|
IncreaseStats(st, c, next_station, effective_capacity /
|
||||||
|
|
|
@ -365,6 +365,7 @@ enum SaveLoadVersion : uint16_t {
|
||||||
SLV_STATION_RATING_CHEAT, ///< 320 PR#11346 Add cheat to fix station ratings at 100%.
|
SLV_STATION_RATING_CHEAT, ///< 320 PR#11346 Add cheat to fix station ratings at 100%.
|
||||||
SLV_TIMETABLE_START_TICKS, ///< 321 PR#11468 Convert timetable start from a date to ticks.
|
SLV_TIMETABLE_START_TICKS, ///< 321 PR#11468 Convert timetable start from a date to ticks.
|
||||||
SLV_TIMETABLE_START_TICKS_FIX, ///< 322 PR#11557 Fix for missing convert timetable start from a date to ticks.
|
SLV_TIMETABLE_START_TICKS_FIX, ///< 322 PR#11557 Fix for missing convert timetable start from a date to ticks.
|
||||||
|
SLV_TIMETABLE_TICKS_TYPE, ///< 323 PR#11435 Convert timetable current order time to ticks.
|
||||||
|
|
||||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||||
};
|
};
|
||||||
|
|
|
@ -720,7 +720,8 @@ public:
|
||||||
SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, SLV_2, SL_MAX_VERSION),
|
SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, SLV_2, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Vehicle, group_id, SLE_UINT16, SLV_60, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, group_id, SLE_UINT16, SLV_60, SL_MAX_VERSION),
|
||||||
|
|
||||||
SLE_CONDVAR(Vehicle, current_order_time, SLE_UINT32, SLV_67, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, current_order_time, SLE_FILE_U32 | SLE_VAR_I32, SLV_67, SLV_TIMETABLE_TICKS_TYPE),
|
||||||
|
SLE_CONDVAR(Vehicle, current_order_time, SLE_INT32, SLV_TIMETABLE_TICKS_TYPE, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Vehicle, last_loading_tick, SLE_UINT64, SLV_LAST_LOADING_TICK, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, last_loading_tick, SLE_UINT64, SLV_LAST_LOADING_TICK, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, SLV_67, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, SLV_67, SL_MAX_VERSION),
|
||||||
};
|
};
|
||||||
|
|
|
@ -1803,7 +1803,7 @@ static SettingsContainer &GetSettingsTree()
|
||||||
interface->Add(new SettingEntry("gui.statusbar_pos"));
|
interface->Add(new SettingEntry("gui.statusbar_pos"));
|
||||||
interface->Add(new SettingEntry("gui.prefer_teamchat"));
|
interface->Add(new SettingEntry("gui.prefer_teamchat"));
|
||||||
interface->Add(new SettingEntry("gui.advanced_vehicle_list"));
|
interface->Add(new SettingEntry("gui.advanced_vehicle_list"));
|
||||||
interface->Add(new SettingEntry("gui.timetable_in_ticks"));
|
interface->Add(new SettingEntry("gui.timetable_mode"));
|
||||||
interface->Add(new SettingEntry("gui.timetable_arrival_departure"));
|
interface->Add(new SettingEntry("gui.timetable_arrival_departure"));
|
||||||
interface->Add(new SettingEntry("gui.show_newgrf_name"));
|
interface->Add(new SettingEntry("gui.show_newgrf_name"));
|
||||||
interface->Add(new SettingEntry("gui.show_cargo_in_vehicle_lists"));
|
interface->Add(new SettingEntry("gui.show_cargo_in_vehicle_lists"));
|
||||||
|
|
|
@ -265,11 +265,7 @@ static void ZoomMinMaxChanged(int32_t)
|
||||||
{
|
{
|
||||||
ConstrainAllViewportsZoom();
|
ConstrainAllViewportsZoom();
|
||||||
GfxClearSpriteCache();
|
GfxClearSpriteCache();
|
||||||
if (_settings_client.gui.zoom_min > _gui_zoom) {
|
if (AdjustGUIZoom(false)) {
|
||||||
/* Restrict GUI zoom if it is no longer available. */
|
|
||||||
_gui_zoom = _settings_client.gui.zoom_min;
|
|
||||||
UpdateCursorSize();
|
|
||||||
LoadStringWidthTable();
|
|
||||||
ReInitAllWindows(true);
|
ReInitAllWindows(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "openttd.h"
|
#include "openttd.h"
|
||||||
#include "rail_gui.h"
|
#include "rail_gui.h"
|
||||||
#include "signal_type.h"
|
#include "signal_type.h"
|
||||||
|
#include "timetable.h"
|
||||||
|
|
||||||
/* Used to validate sizes of "max" value in settings. */
|
/* Used to validate sizes of "max" value in settings. */
|
||||||
const size_t MAX_SLE_UINT8 = UINT8_MAX;
|
const size_t MAX_SLE_UINT8 = UINT8_MAX;
|
||||||
|
@ -167,7 +168,7 @@ struct GUISettings {
|
||||||
SignalCycleSettings cycle_signal_types; ///< Which signal types to cycle with the build signal tool.
|
SignalCycleSettings cycle_signal_types; ///< Which signal types to cycle with the build signal tool.
|
||||||
SignalType default_signal_type; ///< The default signal type, which is set automatically by the last signal used. Not available in Settings.
|
SignalType default_signal_type; ///< The default signal type, which is set automatically by the last signal used. Not available in Settings.
|
||||||
TimerGameCalendar::Year coloured_news_year; ///< when does newspaper become coloured?
|
TimerGameCalendar::Year coloured_news_year; ///< when does newspaper become coloured?
|
||||||
bool timetable_in_ticks; ///< whether to show the timetable in ticks rather than days
|
TimetableMode timetable_mode; ///< Time units for timetables: days, seconds, or ticks
|
||||||
bool quick_goto; ///< Allow quick access to 'goto button' in vehicle orders window
|
bool quick_goto; ///< Allow quick access to 'goto button' in vehicle orders window
|
||||||
bool auto_euro; ///< automatically switch to euro in 2002
|
bool auto_euro; ///< automatically switch to euro in 2002
|
||||||
byte drag_signals_density; ///< many signals density
|
byte drag_signals_density; ///< many signals density
|
||||||
|
|
|
@ -420,14 +420,18 @@ str = STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS
|
||||||
strhelp = STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS_HELPTEXT
|
||||||
strval = STR_CONFIG_SETTING_COMPANIES_OFF
|
strval = STR_CONFIG_SETTING_COMPANIES_OFF
|
||||||
|
|
||||||
[SDTC_BOOL]
|
[SDTC_VAR]
|
||||||
var = gui.timetable_in_ticks
|
var = gui.timetable_mode
|
||||||
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
type = SLE_UINT8
|
||||||
def = false
|
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_DROPDOWN
|
||||||
str = STR_CONFIG_SETTING_TIMETABLE_IN_TICKS
|
def = 0
|
||||||
strhelp = STR_CONFIG_SETTING_TIMETABLE_IN_TICKS_HELPTEXT
|
min = 0
|
||||||
|
max = 2
|
||||||
|
str = STR_CONFIG_SETTING_TIMETABLE_MODE
|
||||||
|
strhelp = STR_CONFIG_SETTING_TIMETABLE_MODE_HELPTEXT
|
||||||
|
strval = STR_CONFIG_SETTING_TIMETABLE_MODE_DAYS
|
||||||
post_cb = [](auto) { InvalidateWindowClassesData(WC_VEHICLE_TIMETABLE, VIWD_MODIFY_ORDERS); }
|
post_cb = [](auto) { InvalidateWindowClassesData(WC_VEHICLE_TIMETABLE, VIWD_MODIFY_ORDERS); }
|
||||||
cat = SC_EXPERT
|
cat = SC_ADVANCED
|
||||||
|
|
||||||
[SDTC_BOOL]
|
[SDTC_BOOL]
|
||||||
var = gui.timetable_arrival_departure
|
var = gui.timetable_arrival_departure
|
||||||
|
|
|
@ -16,6 +16,12 @@
|
||||||
|
|
||||||
static const TimerGameCalendar::Year MAX_TIMETABLE_START_YEARS = 15; ///< The maximum start date offset, in years.
|
static const TimerGameCalendar::Year MAX_TIMETABLE_START_YEARS = 15; ///< The maximum start date offset, in years.
|
||||||
|
|
||||||
|
enum class TimetableMode : uint8_t {
|
||||||
|
Days,
|
||||||
|
Seconds,
|
||||||
|
Ticks,
|
||||||
|
};
|
||||||
|
|
||||||
TimerGameTick::TickCounter GetStartTickFromDate(TimerGameCalendar::Date start_date);
|
TimerGameTick::TickCounter GetStartTickFromDate(TimerGameCalendar::Date start_date);
|
||||||
TimerGameCalendar::Date GetDateFromStartTick(TimerGameTick::TickCounter start_tick);
|
TimerGameCalendar::Date GetDateFromStartTick(TimerGameTick::TickCounter start_tick);
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ CommandCost CmdSetVehicleOnTime(DoCommandFlag flags, VehicleID veh, bool apply_t
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
if (apply_to_group) {
|
if (apply_to_group) {
|
||||||
int32_t most_late = 0;
|
TimerGameTick::Ticks most_late = 0;
|
||||||
for (Vehicle *u = v->FirstShared(); u != nullptr; u = u->NextShared()) {
|
for (Vehicle *u = v->FirstShared(); u != nullptr; u = u->NextShared()) {
|
||||||
/* A vehicle can't be late if its timetable hasn't started. */
|
/* A vehicle can't be late if its timetable hasn't started. */
|
||||||
if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) continue;
|
if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) continue;
|
||||||
|
@ -454,7 +454,7 @@ CommandCost CmdAutofillTimetable(DoCommandFlag flags, VehicleID veh, bool autofi
|
||||||
*/
|
*/
|
||||||
void UpdateVehicleTimetable(Vehicle *v, bool travelling)
|
void UpdateVehicleTimetable(Vehicle *v, bool travelling)
|
||||||
{
|
{
|
||||||
uint time_taken = v->current_order_time;
|
TimerGameTick::Ticks time_taken = v->current_order_time;
|
||||||
|
|
||||||
v->current_order_time = 0;
|
v->current_order_time = 0;
|
||||||
|
|
||||||
|
@ -505,16 +505,15 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
|
||||||
/* Before modifying waiting times, check whether we want to preserve bigger ones. */
|
/* Before modifying waiting times, check whether we want to preserve bigger ones. */
|
||||||
if (!real_current_order->IsType(OT_CONDITIONAL) &&
|
if (!real_current_order->IsType(OT_CONDITIONAL) &&
|
||||||
(travelling || time_taken > real_current_order->GetWaitTime() || remeasure_wait_time)) {
|
(travelling || time_taken > real_current_order->GetWaitTime() || remeasure_wait_time)) {
|
||||||
/* Round the time taken up to the nearest day, as this will avoid
|
/* Round up to the smallest unit of time commonly shown in the GUI (seconds) to avoid confusion.
|
||||||
* confusion for people who are timetabling in days, and can be
|
* Players timetabling in Ticks can adjust later.
|
||||||
* adjusted later by people who aren't.
|
|
||||||
* For trains/aircraft multiple movement cycles are done in one
|
* For trains/aircraft multiple movement cycles are done in one
|
||||||
* tick. This makes it possible to leave the station and process
|
* 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
|
* e.g. a depot order in the same tick, causing it to not fill
|
||||||
* the timetable entry like is done for road vehicles/ships.
|
* the timetable entry like is done for road vehicles/ships.
|
||||||
* Thus always make sure at least one tick is used between the
|
* Thus always make sure at least one tick is used between the
|
||||||
* processing of different orders when filling the timetable. */
|
* processing of different orders when filling the timetable. */
|
||||||
uint time_to_set = CeilDiv(std::max(time_taken, 1U), Ticks::DAY_TICKS) * Ticks::DAY_TICKS;
|
uint time_to_set = CeilDiv(std::max(time_taken, 1), Ticks::TICKS_PER_SECOND) * Ticks::TICKS_PER_SECOND;
|
||||||
|
|
||||||
if (travelling && (autofilling || !real_current_order->IsTravelTimetabled())) {
|
if (travelling && (autofilling || !real_current_order->IsTravelTimetabled())) {
|
||||||
ChangeTimetable(v, v->cur_real_order_index, time_to_set, MTF_TRAVEL_TIME, autofilling);
|
ChangeTimetable(v, v->cur_real_order_index, time_to_set, MTF_TRAVEL_TIME, autofilling);
|
||||||
|
@ -533,7 +532,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
|
||||||
|
|
||||||
if (autofilling) return;
|
if (autofilling) return;
|
||||||
|
|
||||||
uint timetabled = travelling ? real_current_order->GetTimetabledTravel() :
|
TimerGameTick::Ticks timetabled = travelling ? real_current_order->GetTimetabledTravel() :
|
||||||
real_current_order->GetTimetabledWait();
|
real_current_order->GetTimetabledWait();
|
||||||
|
|
||||||
/* Vehicles will wait at stations if they arrive early even if they are not
|
/* Vehicles will wait at stations if they arrive early even if they are not
|
||||||
|
@ -548,7 +547,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
|
||||||
* shorter than the amount of ticks we are late we reduce the lateness by the
|
* shorter than the amount of ticks we are late we reduce the lateness by the
|
||||||
* length of a full cycle till lateness is less than the length of a timetable
|
* length of a full cycle till lateness is less than the length of a timetable
|
||||||
* cycle. When the timetable isn't fully filled the cycle will be Ticks::INVALID_TICKS. */
|
* cycle. When the timetable isn't fully filled the cycle will be Ticks::INVALID_TICKS. */
|
||||||
if (v->lateness_counter > (int)timetabled) {
|
if (v->lateness_counter > timetabled) {
|
||||||
TimerGameTick::Ticks cycle = v->orders->GetTimetableTotalDuration();
|
TimerGameTick::Ticks cycle = v->orders->GetTimetableTotalDuration();
|
||||||
if (cycle != Ticks::INVALID_TICKS && v->lateness_counter > cycle) {
|
if (cycle != Ticks::INVALID_TICKS && v->lateness_counter > cycle) {
|
||||||
v->lateness_counter %= cycle;
|
v->lateness_counter %= cycle;
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
#include "string_func.h"
|
#include "string_func.h"
|
||||||
#include "gfx_func.h"
|
#include "gfx_func.h"
|
||||||
#include "company_func.h"
|
#include "company_func.h"
|
||||||
|
#include "timer/timer.h"
|
||||||
#include "timer/timer_game_tick.h"
|
#include "timer/timer_game_tick.h"
|
||||||
#include "timer/timer_game_calendar.h"
|
#include "timer/timer_game_calendar.h"
|
||||||
|
#include "timer/timer_window.h"
|
||||||
#include "date_gui.h"
|
#include "date_gui.h"
|
||||||
#include "vehicle_gui.h"
|
#include "vehicle_gui.h"
|
||||||
#include "settings_type.h"
|
#include "settings_type.h"
|
||||||
|
@ -47,12 +49,59 @@ struct TimetableArrivalDeparture {
|
||||||
*/
|
*/
|
||||||
void SetTimetableParams(int param1, int param2, TimerGameTick::Ticks ticks)
|
void SetTimetableParams(int param1, int param2, TimerGameTick::Ticks ticks)
|
||||||
{
|
{
|
||||||
if (_settings_client.gui.timetable_in_ticks) {
|
switch (_settings_client.gui.timetable_mode) {
|
||||||
SetDParam(param1, STR_TIMETABLE_TICKS);
|
case TimetableMode::Days:
|
||||||
SetDParam(param2, ticks);
|
SetDParam(param1, STR_UNITS_DAYS);
|
||||||
} else {
|
|
||||||
SetDParam(param1, STR_TIMETABLE_DAYS);
|
|
||||||
SetDParam(param2, ticks / Ticks::DAY_TICKS);
|
SetDParam(param2, ticks / Ticks::DAY_TICKS);
|
||||||
|
break;
|
||||||
|
case TimetableMode::Seconds:
|
||||||
|
SetDParam(param1, STR_UNITS_SECONDS);
|
||||||
|
SetDParam(param2, ticks / Ticks::TICKS_PER_SECOND);
|
||||||
|
break;
|
||||||
|
case TimetableMode::Ticks:
|
||||||
|
SetDParam(param1, STR_UNITS_TICKS);
|
||||||
|
SetDParam(param2, ticks);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of ticks in the current timetable display unit.
|
||||||
|
* @return The number of ticks per day, second, or tick, to match the timetable display.
|
||||||
|
*/
|
||||||
|
static inline TimerGameTick::Ticks TicksPerTimetableUnit()
|
||||||
|
{
|
||||||
|
switch (_settings_client.gui.timetable_mode) {
|
||||||
|
case TimetableMode::Days:
|
||||||
|
return Ticks::DAY_TICKS;
|
||||||
|
case TimetableMode::Seconds:
|
||||||
|
return Ticks::TICKS_PER_SECOND;
|
||||||
|
case TimetableMode::Ticks:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a vehicle should be shown as late, depending on the timetable display setting.
|
||||||
|
* @param v The vehicle in question.
|
||||||
|
* @param round_to_day When using ticks, if we should round up to the nearest day.
|
||||||
|
* @return True if the vehicle is later than the threshold.
|
||||||
|
*/
|
||||||
|
bool VehicleIsAboveLatenessThreshold(const Vehicle *v, bool round_to_day)
|
||||||
|
{
|
||||||
|
switch (_settings_client.gui.timetable_mode) {
|
||||||
|
case TimetableMode::Days:
|
||||||
|
return v->lateness_counter > Ticks::DAY_TICKS;
|
||||||
|
case TimetableMode::Seconds:
|
||||||
|
return v->lateness_counter > Ticks::TICKS_PER_SECOND;
|
||||||
|
case TimetableMode::Ticks:
|
||||||
|
return v->lateness_counter > (round_to_day ? Ticks::DAY_TICKS : 0);
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +232,10 @@ struct TimetableWindow : Window {
|
||||||
assert(HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED));
|
assert(HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED));
|
||||||
|
|
||||||
bool travelling = (!v->current_order.IsType(OT_LOADING) || v->current_order.GetNonStopType() == ONSF_STOP_EVERYWHERE);
|
bool travelling = (!v->current_order.IsType(OT_LOADING) || v->current_order.GetNonStopType() == ONSF_STOP_EVERYWHERE);
|
||||||
TimerGameTick::Ticks start_time = TimerGameCalendar::date_fract - v->current_order_time;
|
TimerGameTick::Ticks start_time = -v->current_order_time;
|
||||||
|
|
||||||
|
/* If arrival and departure times are in days, compensate for the current date_fract. */
|
||||||
|
if (_settings_client.gui.timetable_mode != TimetableMode::Seconds) start_time += TimerGameCalendar::date_fract;
|
||||||
|
|
||||||
FillTimetableArrivalDepartureTable(v, v->cur_real_order_index % v->GetNumOrders(), travelling, table, start_time);
|
FillTimetableArrivalDepartureTable(v, v->cur_real_order_index % v->GetNumOrders(), travelling, table, start_time);
|
||||||
|
|
||||||
|
@ -194,8 +246,15 @@ struct TimetableWindow : Window {
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_VT_ARRIVAL_DEPARTURE_PANEL:
|
case WID_VT_ARRIVAL_DEPARTURE_PANEL:
|
||||||
|
/* We handle this differently depending on the timetable mode. */
|
||||||
|
if (_settings_client.gui.timetable_mode == TimetableMode::Seconds) {
|
||||||
|
/* A five-digit number would fit a timetable lasting 2.7 real-world hours, which should be plenty. */
|
||||||
|
SetDParamMaxDigits(1, 4, FS_SMALL);
|
||||||
|
size->width = std::max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL_SECONDS_IN_FUTURE).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE_SECONDS_IN_FUTURE).width) + WidgetDimensions::scaled.hsep_wide + padding.width;
|
||||||
|
} else {
|
||||||
SetDParamMaxValue(1, TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR), 0, FS_SMALL);
|
SetDParamMaxValue(1, TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR), 0, FS_SMALL);
|
||||||
size->width = std::max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE).width) + WidgetDimensions::scaled.hsep_wide + padding.width;
|
size->width = std::max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL_DATE).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE_DATE).width) + WidgetDimensions::scaled.hsep_wide + padding.width;
|
||||||
|
}
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
|
|
||||||
case WID_VT_ARRIVAL_DEPARTURE_SELECTION:
|
case WID_VT_ARRIVAL_DEPARTURE_SELECTION:
|
||||||
|
@ -436,7 +495,7 @@ struct TimetableWindow : Window {
|
||||||
int selected = this->sel_index;
|
int selected = this->sel_index;
|
||||||
|
|
||||||
Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
|
Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
|
||||||
bool show_late = this->show_expected && v->lateness_counter > Ticks::DAY_TICKS;
|
bool show_late = this->show_expected && VehicleIsAboveLatenessThreshold(v, true);
|
||||||
TimerGameTick::Ticks offset = show_late ? 0 : -v->lateness_counter;
|
TimerGameTick::Ticks offset = show_late ? 0 : -v->lateness_counter;
|
||||||
|
|
||||||
for (int i = this->vscroll->GetPosition(); i / 2 < v->GetNumOrders(); ++i) { // note: i is also incremented in the loop
|
for (int i = this->vscroll->GetPosition(); i / 2 < v->GetNumOrders(); ++i) { // note: i is also incremented in the loop
|
||||||
|
@ -460,14 +519,28 @@ struct TimetableWindow : Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now actually draw the arrival time. */
|
/* Now actually draw the arrival time. */
|
||||||
|
if (_settings_client.gui.timetable_mode == TimetableMode::Seconds) {
|
||||||
|
/* Display seconds from now. */
|
||||||
|
SetDParam(1, ((arr_dep[i / 2].arrival + offset) / Ticks::TICKS_PER_SECOND));
|
||||||
|
DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_ARRIVAL_SECONDS_IN_FUTURE, i == selected ? TC_WHITE : TC_BLACK);
|
||||||
|
} else {
|
||||||
|
/* Show a date. */
|
||||||
SetDParam(1, TimerGameCalendar::date + (arr_dep[i / 2].arrival + this_offset) / Ticks::DAY_TICKS);
|
SetDParam(1, TimerGameCalendar::date + (arr_dep[i / 2].arrival + this_offset) / Ticks::DAY_TICKS);
|
||||||
DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_ARRIVAL, i == selected ? TC_WHITE : TC_BLACK);
|
DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_ARRIVAL_DATE, i == selected ? TC_WHITE : TC_BLACK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Draw a departure time. */
|
/* Draw a departure time. */
|
||||||
if (arr_dep[i / 2].departure != Ticks::INVALID_TICKS) {
|
if (arr_dep[i / 2].departure != Ticks::INVALID_TICKS) {
|
||||||
|
if (_settings_client.gui.timetable_mode == TimetableMode::Seconds) {
|
||||||
|
/* Display seconds from now. */
|
||||||
|
SetDParam(1, ((arr_dep[i / 2].departure + offset) / Ticks::TICKS_PER_SECOND));
|
||||||
|
DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_DEPARTURE_SECONDS_IN_FUTURE, i == selected ? TC_WHITE : TC_BLACK);
|
||||||
|
} else {
|
||||||
|
/* Show a date. */
|
||||||
SetDParam(1, TimerGameCalendar::date + (arr_dep[i / 2].departure + offset) / Ticks::DAY_TICKS);
|
SetDParam(1, TimerGameCalendar::date + (arr_dep[i / 2].departure + offset) / Ticks::DAY_TICKS);
|
||||||
DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_DEPARTURE, i == selected ? TC_WHITE : TC_BLACK);
|
DrawString(tr.left, tr.right, tr.top, STR_TIMETABLE_DEPARTURE_DATE, i == selected ? TC_WHITE : TC_BLACK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tr.top += GetCharacterHeight(FS_NORMAL);
|
tr.top += GetCharacterHeight(FS_NORMAL);
|
||||||
|
@ -490,19 +563,28 @@ struct TimetableWindow : Window {
|
||||||
}
|
}
|
||||||
tr.top += GetCharacterHeight(FS_NORMAL);
|
tr.top += GetCharacterHeight(FS_NORMAL);
|
||||||
|
|
||||||
|
/* Draw the lateness display, or indicate that the timetable has not started yet. */
|
||||||
if (v->timetable_start != 0) {
|
if (v->timetable_start != 0) {
|
||||||
/* We are running towards the first station so we can start the
|
/* We are running towards the first station so we can start the
|
||||||
* timetable at the given time. */
|
* timetable at the given time. */
|
||||||
|
if (_settings_client.gui.timetable_mode == TimetableMode::Seconds) {
|
||||||
|
/* Real time units use seconds relative to now. */
|
||||||
|
SetDParam(0, (static_cast<TimerGameTick::Ticks>(v->timetable_start - TimerGameTick::counter) / Ticks::TICKS_PER_SECOND));
|
||||||
|
DrawString(tr, STR_TIMETABLE_STATUS_START_IN_SECONDS);
|
||||||
|
} else {
|
||||||
|
/* Calendar units use dates. */
|
||||||
SetDParam(0, STR_JUST_DATE_TINY);
|
SetDParam(0, STR_JUST_DATE_TINY);
|
||||||
SetDParam(1, GetDateFromStartTick(v->timetable_start));
|
SetDParam(1, GetDateFromStartTick(v->timetable_start));
|
||||||
DrawString(tr, STR_TIMETABLE_STATUS_START_AT);
|
DrawString(tr, STR_TIMETABLE_STATUS_START_AT_DATE);
|
||||||
|
}
|
||||||
} else if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) {
|
} else if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) {
|
||||||
/* We aren't running on a timetable yet, so how can we be "on time"
|
/* We aren't running on a timetable yet. */
|
||||||
* when we aren't even "on service"/"on duty"? */
|
|
||||||
DrawString(tr, STR_TIMETABLE_STATUS_NOT_STARTED);
|
DrawString(tr, STR_TIMETABLE_STATUS_NOT_STARTED);
|
||||||
} else if (v->lateness_counter == 0 || (!_settings_client.gui.timetable_in_ticks && v->lateness_counter / Ticks::DAY_TICKS == 0)) {
|
} else if (!VehicleIsAboveLatenessThreshold(v, false)) {
|
||||||
|
/* We are on time. */
|
||||||
DrawString(tr, STR_TIMETABLE_STATUS_ON_TIME);
|
DrawString(tr, STR_TIMETABLE_STATUS_ON_TIME);
|
||||||
} else {
|
} else {
|
||||||
|
/* We are late. */
|
||||||
SetTimetableParams(0, 1, abs(v->lateness_counter));
|
SetTimetableParams(0, 1, abs(v->lateness_counter));
|
||||||
DrawString(tr, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE);
|
DrawString(tr, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE);
|
||||||
}
|
}
|
||||||
|
@ -556,7 +638,13 @@ struct TimetableWindow : Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_VT_START_DATE: // Change the date that the timetable starts.
|
case WID_VT_START_DATE: // Change the date that the timetable starts.
|
||||||
ShowSetDateWindow(this, v->index, TimerGameCalendar::date, TimerGameCalendar::year, TimerGameCalendar::year + MAX_TIMETABLE_START_YEARS, ChangeTimetableStartCallback, reinterpret_cast<void *>(static_cast<uintptr_t>(_ctrl_pressed)));
|
if (_settings_client.gui.timetable_mode == TimetableMode::Seconds) {
|
||||||
|
this->query_widget = WID_VT_START_DATE;
|
||||||
|
this->change_timetable_all = _ctrl_pressed;
|
||||||
|
ShowQueryString(STR_EMPTY, STR_TIMETABLE_START_SECONDS_QUERY, 6, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED);
|
||||||
|
} else {
|
||||||
|
ShowSetDateWindow(this, v->index, TimerGameCalendar::date, TimerGameCalendar::year, TimerGameCalendar::year + MAX_TIMETABLE_START_YEARS, ChangeTimetableStartCallback, reinterpret_cast<void*>(static_cast<uintptr_t>(_ctrl_pressed)));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_VT_CHANGE_TIME: { // "Wait For" button.
|
case WID_VT_CHANGE_TIME: { // "Wait For" button.
|
||||||
|
@ -571,7 +659,7 @@ struct TimetableWindow : Window {
|
||||||
|
|
||||||
if (order != nullptr) {
|
if (order != nullptr) {
|
||||||
uint time = (selected % 2 != 0) ? order->GetTravelTime() : order->GetWaitTime();
|
uint time = (selected % 2 != 0) ? order->GetTravelTime() : order->GetWaitTime();
|
||||||
if (!_settings_client.gui.timetable_in_ticks) time /= Ticks::DAY_TICKS;
|
time /= TicksPerTimetableUnit();
|
||||||
|
|
||||||
if (time != 0) {
|
if (time != 0) {
|
||||||
SetDParam(0, time);
|
SetDParam(0, time);
|
||||||
|
@ -667,7 +755,7 @@ struct TimetableWindow : Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_VT_CHANGE_TIME:
|
case WID_VT_CHANGE_TIME:
|
||||||
if (!_settings_client.gui.timetable_in_ticks) val *= Ticks::DAY_TICKS;
|
val *= TicksPerTimetableUnit();
|
||||||
|
|
||||||
if (this->change_timetable_all) {
|
if (this->change_timetable_all) {
|
||||||
Command<CMD_BULK_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, mtf, ClampTo<uint16_t>(val));
|
Command<CMD_BULK_CHANGE_TIMETABLE>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, mtf, ClampTo<uint16_t>(val));
|
||||||
|
@ -676,6 +764,12 @@ struct TimetableWindow : Window {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WID_VT_START_DATE: {
|
||||||
|
TimerGameTick::TickCounter start_tick = TimerGameTick::counter + (val * Ticks::TICKS_PER_SECOND);
|
||||||
|
Command<CMD_SET_TIMETABLE_START>::Post(STR_ERROR_CAN_T_TIMETABLE_VEHICLE, v->index, this->change_timetable_all, start_tick);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
@ -695,6 +789,15 @@ struct TimetableWindow : Window {
|
||||||
this->GetWidget<NWidgetStacked>(WID_VT_ARRIVAL_DEPARTURE_SELECTION)->SetDisplayedPlane(_settings_client.gui.timetable_arrival_departure ? 0 : SZSP_NONE);
|
this->GetWidget<NWidgetStacked>(WID_VT_ARRIVAL_DEPARTURE_SELECTION)->SetDisplayedPlane(_settings_client.gui.timetable_arrival_departure ? 0 : SZSP_NONE);
|
||||||
this->GetWidget<NWidgetStacked>(WID_VT_EXPECTED_SELECTION)->SetDisplayedPlane(_settings_client.gui.timetable_arrival_departure ? 0 : 1);
|
this->GetWidget<NWidgetStacked>(WID_VT_EXPECTED_SELECTION)->SetDisplayedPlane(_settings_client.gui.timetable_arrival_departure ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In real-time mode, the timetable GUI shows relative times and needs to be redrawn every second.
|
||||||
|
*/
|
||||||
|
IntervalTimer<TimerGameTick> redraw_interval = {Ticks::TICKS_PER_SECOND, [this](auto) {
|
||||||
|
if (_settings_client.gui.timetable_mode == TimetableMode::Seconds) {
|
||||||
|
this->SetDirty();
|
||||||
|
}
|
||||||
|
}};
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NWidgetPart _nested_timetable_widgets[] = {
|
static const NWidgetPart _nested_timetable_widgets[] = {
|
||||||
|
@ -725,7 +828,7 @@ static const NWidgetPart _nested_timetable_widgets[] = {
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VT_CLEAR_SPEED), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_CLEAR_SPEED, STR_TIMETABLE_CLEAR_SPEED_TOOLTIP),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VT_CLEAR_SPEED), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_CLEAR_SPEED, STR_TIMETABLE_CLEAR_SPEED_TOOLTIP),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
NWidget(NWID_VERTICAL, NC_EQUALSIZE),
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VT_START_DATE), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_STARTING_DATE, STR_TIMETABLE_STARTING_DATE_TOOLTIP),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VT_START_DATE), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_START, STR_TIMETABLE_START_TOOLTIP),
|
||||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VT_RESET_LATENESS), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_RESET_LATENESS, STR_TIMETABLE_RESET_LATENESS_TOOLTIP),
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VT_RESET_LATENESS), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_RESET_LATENESS, STR_TIMETABLE_RESET_LATENESS_TOOLTIP),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
NWidget(NWID_VERTICAL, NC_EQUALSIZE),
|
NWidget(NWID_VERTICAL, NC_EQUALSIZE),
|
||||||
|
|
|
@ -2333,7 +2333,7 @@ void Vehicle::HandleLoading(bool mode)
|
||||||
{
|
{
|
||||||
switch (this->current_order.GetType()) {
|
switch (this->current_order.GetType()) {
|
||||||
case OT_LOADING: {
|
case OT_LOADING: {
|
||||||
uint wait_time = std::max(this->current_order.GetTimetabledWait() - this->lateness_counter, 0);
|
TimerGameTick::Ticks wait_time = std::max(this->current_order.GetTimetabledWait() - this->lateness_counter, 0);
|
||||||
|
|
||||||
/* Not the first call for this tick, or still loading */
|
/* Not the first call for this tick, or still loading */
|
||||||
if (mode || !HasBit(this->vehicle_flags, VF_LOADING_FINISHED) || this->current_order_time < wait_time) return;
|
if (mode || !HasBit(this->vehicle_flags, VF_LOADING_FINISHED) || this->current_order_time < wait_time) return;
|
||||||
|
|
|
@ -1807,9 +1807,12 @@ void InitWindowSystem()
|
||||||
_scrolling_viewport = false;
|
_scrolling_viewport = false;
|
||||||
_mouse_hovering = false;
|
_mouse_hovering = false;
|
||||||
|
|
||||||
|
SetupWidgetDimensions();
|
||||||
NWidgetLeaf::InvalidateDimensionCache(); // Reset cached sizes of several widgets.
|
NWidgetLeaf::InvalidateDimensionCache(); // Reset cached sizes of several widgets.
|
||||||
NWidgetScrollbar::InvalidateDimensionCache();
|
NWidgetScrollbar::InvalidateDimensionCache();
|
||||||
|
|
||||||
|
InitDepotWindowBlockSizes();
|
||||||
|
|
||||||
ShowFirstError();
|
ShowFirstError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue